rtalmeida Posted May 31, 2017 Share Posted May 31, 2017 I'm creating unidbgrid and it's partially working, I'm not able to set the Filtering.editor property to below the code I'm doing. Grade.Columns.Clear; Grade.Columns.BeginUpdate; tmpCons.first; while not tmpCons.eof do begin with Grade do begin with Columns.Add do begin FieldName := tmpCons.fieldbyname('campo').asstring; Title.Caption := tmpCons.fieldbyname('titulo').asstring; Width := tmpCons.fieldbyname('tamanho').asinteger; Font.Charset := ANSI_CHARSET; Font.Name := 'Verdana'; DisplayMemo := True; Sortable := True; if tmpCons.fieldbyname('tipo').asstring = 'TUniEdit' then begin with TUniEdit.Create(Self) as TUniEdit do begin Left := 10; Top := 10; Parent := UniHiddenPanel1; Text := ''; Name := 'Edit'+tmpCons.fieldbyname('campo').asstring; end; Filtering.Enabled := True; Filtering.editor := TUniEdit(FindComponent('Edit'+tmpCons.fieldbyname('campo').asstring)); end; end; end; tmpCons.next; end; Grade.Columns.EndUpdate; what am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 1, 2017 Share Posted June 1, 2017 Hi, Filtering.editor := TUniEdit(Self.FindComponent('Edit'+tmpCons.fieldbyname('campo').asstring)); Best regards, Quote Link to comment Share on other sites More sharing options...
rtalmeida Posted June 1, 2017 Author Share Posted June 1, 2017 Thank you very much Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted June 7, 2017 Share Posted June 7, 2017 Hi, Filtering.editor := TUniEdit(Self.FindComponent('Edit'+tmpCons.fieldbyname('campo').asstring)); Best regards, Can you remove the filter at run time? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 9, 2017 Share Posted June 9, 2017 Hi, Can you remove the filter at run time? It can be added in the next versions.. Can you try this approach for now ?!: type TExUniCustomDBGrid = class (TUniCustomDBGrid) end; procedure TMainForm.UniButton1Click(Sender: TObject); begin // clear filters UniDBGrid1ClearFilters(UniDBGrid1); UniDBGrid1.Columns[1].Filtering.Enabled := False; TExUniCustomDBGrid(UniDBGrid1).DoConfigureJSColumns(UniDBGrid1.DataSource.DataSet); end; Best regards, Quote Link to comment Share on other sites More sharing options...
arilotta Posted November 23, 2017 Share Posted November 23, 2017 Hi Delphi Dev, I tried your solution to show/hide the filter at runtime because I was interested in such a feature in the application I'm developing: procedure TMainForm.UniButton1Click(Sender: TObject); begin GRDconfig_LK.Columns[1].Filtering.enabled:=not GRDconfig_LK.Columns[1].Filtering.enabled; TExUniCustomDBGrid(GRDconfig_LK).DoConfigureJSColumns(GRDconfig_LK.DataSource.DataSet); end; It works fine the first time, then I get the following error: O130 is not defined delete O115_Cols;delete O115.view.cachedColumns; O198=new Ext.grid.column.Column({ogrid:O115,sortable:false,dataIndex:"0",renderer:_rndcll_,rdonly:true,text:" ",menuDisabled:true,width:20,unEditable:true});O198.nm="O198"; O199=new Ext.grid.column.Column({ogrid:O115,flex:1,dataIndex:"1",renderer:_rndcll_,rdonly:true,text:"Descrizione",menuDisabled:true,width:781,unEditable:true,items:[O130],fedit:O130,padding:"0 0 0 5"});O199.nm="O199";O130.setWidth(771);O199.on("afterrender",function(s){s.el.on("click",function(){O199.fedit.focus()})}); O19A=new Ext.grid.column.Column({ogrid:O115,dataIndex:"2",renderer:_rndcll_,rdonly:true,text:"Dal",menuDisabled:true,width:80,unEditable:true});O19A.nm="O19A"; O19B=new Ext.grid.column.Column({ogrid:O115,dataIndex:"3",renderer:_rndcll_,rdonly:true,text:"al",menuDisabled:true,width:80,unEditable:true});O19B.nm="O19B";var O115_Cols=[O198,O199,O19A,O19B];O115.reconfigure(null,O115_Cols);O115.uniConfigColumns(); O130 is not defined Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 23, 2017 Share Posted November 23, 2017 Hi, Can you make a simple testcase for this ?! Best regards, Quote Link to comment Share on other sites More sharing options...
arilotta Posted November 23, 2017 Share Posted November 23, 2017 Hi Delphi Dev, you can download a simple test case at this link: https://drive.google.com/file/d/1oKkiCC8GvpKdSTcNCZxW3U2wRYtPspNX/view?usp=sharing Click the check box at the bottom, at the second click you receive an error. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 23, 2017 Share Posted November 23, 2017 Hi, Ok, I will check it Quote Link to comment Share on other sites More sharing options...
arilotta Posted December 5, 2017 Share Posted December 5, 2017 I've found the solution Delphi Dev. It seems that if the hidden panel is placed "below" other controls the problem arises. In the test case I've prepared, if you select UniHiddenPanel1 in the structure view, then Control \ Bring To Front, everything works fine... Quote Link to comment Share on other sites More sharing options...
arilotta Posted December 27, 2018 Share Posted December 27, 2018 Hi Sherzod, going on porting our SW to EXTJS 6. I used the above solution to open/close the filters at runtime, and in EXTJS 4.2 it worked pretty well. In EXTJS6.5 calling "DoConfigureJSColumns" makes the DbGrid lose the selection, the selected record is no longer highlighted and you need to click on the grid to select it again. Please find attached a simple test application, just select a record and push the ConfigureJSColumns button to recreate the issue. I tried to call something like: JSInterface.JSCall('view.refresh', []); but it does not work... thanks Andrea TestHints.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 27, 2018 Share Posted December 27, 2018 Hi, I will check it a bit later Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 27, 2018 Share Posted December 27, 2018 Hi, Sorry, I did not fully checked But, maybe like this for now..: procedure TMainForm.UniButton1Click(Sender: TObject); begin TExUniCustomDBGrid(DBgridLista).DoConfigureJSColumns(DBgridLista.DataSource.DataSet); DBgridLista.CurrRow := 0; end; Quote Link to comment Share on other sites More sharing options...
arilotta Posted December 28, 2018 Share Posted December 28, 2018 Thank you, it works. Done this way: procedure TMainForm.UniButton1Click(Sender: TObject); var r: Integer; begin r:=DBgridLista.CurrRow TExUniCustomDBGrid(DBgridLista).DoConfigureJSColumns(DBgridLista.DataSource.DataSet); DBgridLista.CurrRow:=; end; 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.