bruno65 Posted March 7 Share Posted March 7 The uniDBGrid doesn't have design columns. So i want to set dynamically column filtering editor : procedure TMainForm.UniDBGrid2BeforeLoad(Sender: TUniCustomDBGrid); var LGrid: TUniDBGrid; begin LGrid := TUniDBGrid(Sender); LGrid.Columns[1].Filtering.Editor := UniEdit3; LGrid.Columns[1].Filtering.Enabled := True; .... LGrid.Options := LGrid.Options + [dgFilterClearButton]; end; Editors don't appear in the top of the columns : Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 7 Author Share Posted March 7 i try this JSInterface.JSCall('setEditor', [UniEdit3.JSControl], LGrid.Columns[1].JSColumn); // instead of LGrid.Columns[1].Filtering.Editor := UniEdit3; but no editor again Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 7 Author Share Posted March 7 i try this type TExUniCustomDBGrid = class (TUniCustomDBGrid); ... procedure TMainForm.btFilterClick(Sender: TObject); begin FShowFilter := not FShowFilter; ShowFilterColumns(FShowFilter); if FShowFilter then btFilter.Caption := 'Masquer filtres' else btFilter.Caption := 'Afficher filtres'; end; procedure TMainForm.ShowFilterColumns(AShowFilter: Boolean); begin UniDBGrid2.Columns[1].Filtering.Editor := UniEdit3; UniDBGrid2.Columns[4].Filtering.Editor := UniDateTimePicker3; UniDBGrid2.Columns[5].Filtering.Editor := UniFormattedNumberEdit2; UniDBGrid2.Columns[1].Filtering.Enabled := AShowFilter; UniDBGrid2.Columns[4].Filtering.Enabled := AShowFilter; UniDBGrid2.Columns[5].Filtering.Enabled := AShowFilter; if AShowFilter then UniDBGrid2.Options := UniDBGrid2.Options + [dgFilterClearButton] else UniDBGrid2.Options := UniDBGrid2.Options - [dgFilterClearButton]; TExUniCustomDBGrid(UniDBGrid2).DoConfigureJSColumns(UniDBGrid2.DataSource.DataSet); end; clear button ok but no editor filters again ! Why is it not intuitive and simple to do basic things like this ? Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 8 Author Share Posted March 8 After looking deeper in uniGUI code, successive calls seem to be : 1-procedure TUniCustomDBGrid.DoConfigureJSColumns(ADataSet: TDataSet); 2-procedure TUniCustomDBGrid.CreateJSColumns(JSColumns: TUniJSGridColumns; ADataSet: TDataSet); 3-function TUniCustomDBGrid.CreateJSColumn(JSColumns: TUniJSGridColumns; Column: TUniBaseDBGridColumn; ADataSet: TDataSet = nil): TJSGridColumn; 4-procedure TUniCustomDBGrid.JSConfigColumn(Column: TUniBaseDBGridColumn; JSCol: TJSGridColumn; Fld : TField); 5-procedure TUniCustomDBGridColumn.InitFilter(C: TJSObject; Fld: TField); Especially in the end of procedure TUniCustomDBGrid.JSConfigColumn() ... if JSCol.HasEditor then TUniCustomDBGridColumn(Column).InitEditor(JSCol, Fld, (not AllowEdit) and RowEditor); if TUniCustomDBGridColumn(Column).FFiltering.Enabled then TUniCustomDBGridColumn(Column).InitFilter(JSCol, Fld); And in the procedure TUniCustomDBGridColumn.InitFilter() ... FEdit := FFiltering.Editor as TUniFormControl; ... with FGrid do begin if not FEdit.IsMultiComponent then JSAddListener('afterrender', JSFunction('s', 's.el.on("click",function(){'#1'.fedit.focus()})'), C); JSConfig('items', [JSArray([FEdit.JSControl])], C); JSConfig('fedit', [FEdit.JSControl], C); JSAssign('isFilter', [True], FEdit.JSControl); JSConfig('padding', ['0 0 0 5'], C); end; Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 11 Author Share Posted March 11 testUniDBGridFilterAndSort.zip i use buttons for sorting and filtering data in uniDBGrid. It works but after a while of clicking on these 2 buttons some header columns have disappeared and the application is out Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 11 Share Posted March 11 Hello, How to reproduce? It seems to work for me. Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 12 Author Share Posted March 12 Hi Sherzod, reproduce the bug is not trivial. It seems to occur "randomly" after clicking on the 2 buttons but it could be happened quickly Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 12 Share Posted March 12 24 minutes ago, bruno65 said: reproduce the bug is not trivial. It seems to occur "randomly" after clicking on the 2 buttons but it could be happened quickly The button can be disabled until the next click... Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 12 Author Share Posted March 12 the bug can happen whatever the speed of clicking on the buttons. There is really no effect to generate the bug Beside we are interesting of how to disable a button until the next click for other use cases : can you share us the code ? Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 14 Author Share Posted March 14 by completing the previously attached project I can generate this bug again. Use-case : 1 - modify one or more cells in one or more records 2- click the button "Sauver" for saving data (and reload it) Redo the 2 steps above one more (or several) time again... and you'll get the error at step 1 and any cell could not be modified. The application is OUT testUniDBGridFilterAndSort.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 14 Share Posted March 14 I will try to check later, thanks. Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 15 Author Share Posted March 15 Hi Sherzod, one more information : even if i modify the project by creating all columns in design mode the same bug appears Quote Link to comment Share on other sites More sharing options...
bruno65 Posted March 22 Author Share Posted March 22 Any solution to fix bugs in the last attached project ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25 Share Posted March 25 On 3/22/2024 at 7:04 PM, bruno65 said: Any solution to fix bugs in the last attached project ? I have analyzed for this button: btFilter On 3/12/2024 at 3:15 PM, Sherzod said: The button can be disabled until the next click... I have already noted this before, try... btFilter.ClientEvents.ExtEvents -> function click(sender, e, eOpts) { sender.showMask('Please wait...'); } 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.