//The following is mainly for the query out of the data, filtered to get the data to be reversed, and then modify the selected data (select All or part of the selection can also be modified according to some code)Screen.cursor: =crhourglass; cxGrid2DBTableView1.DataController.GotoFirst; forI: =0 toCxgrid2DBTableView1.DataController.FilteredRecordCount-1 Do begin ifCxGrid2DBTableView1.DataController.GetItemByFieldName ('IsChecked'). EditValue = True Then beginCxGrid2DBTableView1.DataController.GetItemByFieldName ('IsChecked'). EditValue: =False; End Else ifCxGrid2DBTableView1.DataController.GetItemByFieldName ('IsChecked'). EditValue = False Then beginCxGrid2DBTableView1.DataController.GetItemByFieldName ('IsChecked'). EditValue: =True; End; CxGrid2DBTableView1.DataController.GotoNext; End; Screen.cursor:=Crdefault;//Cxgrid2DBTableView1.DataController.FilteredRecordCount This is the number of data rows to be filtered//cxGrid2DBTableView1.DataController.GetItemByFieldName (' IsChecked '). EditValue This is the value of the field to be modifiedThe selection button has three options: Select All, reverse Select, Cancel all the general is this: first query, then filter (the query out of the data some inappropriate to filter), and then select the column tick (if the data more than one tick is too troublesome), you can modify the state of the data, the above code can be filtered out of the Data for the inverse selection operation. (Full or full cancellation is also very simple, referring to the code above), previously written code to filter out the useless data is also in the anti-select or select all operations, this is no problem
Using Filter:
procedure Tform2.button3click (Sender: TObject); var I:integer; begin for I: = 0 to CxGrid1DBTableView1.DataController.FilteredRecordCount-1 do begin CxGrid1DBTableView1.DataController.FocusedRecordIndex: = Cxgrid1dbtableview1.datacontroller.filteredrecordindex[i]; CxGrid1DBTableView1.DataController.SetEditValue (Cxgrid1dbtableview1reviewed.index, True, evsvalue) end ; end ;
Cxgrid Selection of filtered data (inverse selection)