bruno65 Posted April 10 Share Posted April 10 How can i change default labels 'Filters', 'Before', and so on... in another language ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 16 minutes ago, bruno65 said: How can i change default labels 'Filters', 'Before', and so on... in another language ? This post may help you: Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 10 Author Share Posted April 10 I use Delphi code (not extjs) : JSConfigPlugin('Ext.grid.filters.Filters', ['id', 'gridFilters']); So how can i translate in Delphi code ? Quote fp.setConfig({menuFilterText: 'Фильтр'} and is it possible to change labels inside default editors ? (see the screenshot above : example for date type) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 10 minutes ago, bruno65 said: I use Delphi code Okay, then tell me how do you assign the "date" type to the filter using Delphi code? Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 10 Author Share Posted April 10 like this TUniFilterDBGridColumn = class(TUniDBDesktopGridColumn) private FFilter: String; public property Filter: String read FFilter write FFilter; end; ... function TIUMGrid.CreateJSColumn(JSColumns: TUniJSGridColumns; Column: TUniBaseDBGridColumn; ADataSet: TDataSet): TJSGridColumn; begin inherited; JSConfig('filter', [TUniFilterDBGridColumn(Column).Filter], Column.JSColumn); end; ... procedure TFrameListeCommun.CreateFilters; var i:integer; FieldType: TFieldType; Column: TUniDBGridColumn; begin // grdListe.JSInterface.JSConfigPlugin('Ext.grid.filters.Filters', ['id', 'gridFilters']); for i := 0 to grdListe.Columns.Count - 1 do begin Column := grdListe.Columns[i]; // Column.Filtering.Enabled := True; Column.Sortable := True; FieldType := grdListe.DataSource.DataSet.FindField(Column.FieldName).DataType; case FieldType of ftString : TUniFilterDBGridColumn(Column).Filter := 'string'; ftDate, ftDateTime: TUniFilterDBGridColumn(Column).Filter := 'date'; ftInteger, ftFloat: TUniFilterDBGridColumn(Column).Filter := 'number'; ftBoolean : TUniFilterDBGridColumn(Column).Filter := 'boolean'; else TUniFilterDBGridColumn(Column).Filter := 'list'; // grdListe.JSInterface.JSConfig('filter', ['list'], Column.JSColumn); end; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 1 hour ago, bruno65 said: JSConfigPlugin('Ext.grid.filters.Filters', ['id', 'gridFilters']); Can you check this? JSConfigPlugin('Ext.grid.filters.Filters', ['id', 'gridFilters', 'menuFilterText', 'Filters!']); Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 10 Author Share Posted April 10 Great ! it works fine for the popup menu items. Thank you And what do you think about the default editor itself ? (for labels of course) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 59 minutes ago, bruno65 said: JSConfig('filter', [TUniFilterDBGridColumn(Column).Filter], Column.JSColumn); Check if this will work. JSConfig('filter', [TUniFilterDBGridColumn(Column).Filter], Column.JSColumn); JSConfigObject('filter', 'fields', [JSStatement('{lt: { text: "Before!" }, gt: { text: "After!"}, eq: { text: "On!"}}')], Column.JSColumn); //add this... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 * Don't forget also the condition to check for date type. Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 10 Author Share Posted April 10 I do this changes in my code function TIUMGrid.CreateJSColumn(JSColumns: TUniJSGridColumns; Column: TUniBaseDBGridColumn; ADataSet: TDataSet): TJSGridColumn; var FieldType: TFieldType; begin inherited; FieldType := DataSet.FindField(Column.FieldName).DataType; case FieldType of ftDate, ftDateTime: begin TUniFilterDBGridColumn(Column).Filter := 'date'; JSConfigObject('filter', 'fields', [JSStatement('{lt: { text: "Avant" }, gt: { text: "Après"}, eq: { text: "Le"}}')], Column.JSColumn); end else JSConfig('filter', [TUniFilterDBGridColumn(Column).Filter], Column.JSColumn); end; Strange : the editor filter of date type is now a text editor Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 10 Author Share Posted April 10 if I check the editor filter for data number : it's ok Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 10 Share Posted April 10 51 minutes ago, bruno65 said: Strange : the editor filter of date type is now a text editor Ok, try this approach: JSConfig('filter', [TUniFilterDBGridColumn(Column).Filter], Column.JSColumn); JSConfigObject('filter', 'fields', [JSStatement('{lt: { text: "Before!" }, gt: { text: "After!"}, eq: { text: "On!"}}')], Column.JSColumn); //add this... JSConfig('filter', [JSStatement('{type: "date", fields: {lt: { text: "Before!" }, gt: { text: "After!"}, eq: { text: "On!"}}}')], Column.JSColumn); Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 11 Author Share Posted April 11 Very good Sherzod ! Thank you Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 11 Author Share Posted April 11 Last question : why the code below is not good for sorting column ? JSConfig('sortable', [JSStatement('{"true"}')], Column.JSColumn); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 11 Share Posted April 11 You can try this: JSConfig('sortable', [True], Column.JSColumn); Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 11 Author Share Posted April 11 I found it ! JSConfig('sortable', [JSStatement('true')], Column.JSColumn); Quote Link to comment Share on other sites More sharing options...
bruno65 Posted April 11 Author Share Posted April 11 Yes your solution it's easier Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.