Cxgrid to the first line (single and multiple selection) after de-filtering and sortingoriginal October 06, 2013 18:42:24
The function Focusedrecordindex in Datacontoller does not respond, focusedrowindex normal.
CxgrdtvGrid1DBTableView1.DataController.FocusedRecordIndex: = 0; Position to first row, sort filter no response
CxgrdtvGrid1DBTableView1.DataController.FocusedRowIndex: = 0; Position to first row, sort filter is still normal
Sort events: Onsortingchanged of Datacontroller in Cxgriddbtableview
Filter the corresponding event: The onchanged of the Datacontroller filter in the Cxgriddbtableview
Only set Dcofocustoprowaftersorting to True if you navigate to the first line after "sort"
1. Test Cxgrid Cxgriddbbandtableview components after sorting or filtering: (Radio: Multselect property set to False)
Sort: devexpress1226 version of Dcofocustoprowaftersorting is set to true to focus automatically to the first row, with selected row focus and color indication in a single radio state
Filter: The default setting, the filter is still filtered by default when the selected line, increase Cxgriddbtableview in the Datacontroller filter onchanged the following line of code, The first row is selected (Focus and selected row color are positioned to the first row) after canceling the filter
[Delphi]View PlainCopy
- Var
- Filter:tcxdatafiltercriteria; //Define Filter Object
- Begin
- With Sender as tcxdatafiltercriteria do
- If IsEmpty then //action filter triggers a filter event to determine if the filter is empty, that is: whether to cancel the filter
- begin
- Cxgrdtvgrid1dbtableview1. Datacontroller. Focusedrowindex: = 0; //Focus position to first row
- end;
2, for multi-choice situation, otherwise the focus (the dashed box can be seen) can be moved, but the selected row color flag (background color) does not; (Multi-select: Multselect property set to True)
Sort: devexpress1226 version of dcofocustoprowaftersorting set to true to focus automatically to the first row, multi-select only focus indicator no selected row color indicator
Filter: The default setting, the filter is still filtered by default when the selected line, increase Cxgriddbtableview in the Datacontroller filter onchanged the following line of code, When the filter is deselected, the first row (focus and the selected row color are positioned to the first row) will be selected at this time, regardless of whether the selected row or multiple selection is selected.
[Delphi]View PlainCopy
- Var
- Filter:tcxdatafiltercriteria;
- Begin
- With Sender as tcxdatafiltercriteria do
- If IsEmpty then //action filter triggers a filter event to determine if the filter is empty, that is: whether to cancel the filter
- begin
- Cxgrdtvgrid1dbtableview1. Optionsselection. MultiSelect: = False;
- Cxgrdtvgrid1dbtableview1. Datacontroller. Focusedrowindex: = 0; <span style= "font-size:14px;font-family:arial;" >//focus to First line </span>
- Cxgrdtvgrid1dbtableview1. Optionsselection. MultiSelect: = True;
- end;
3, Cxgrid1dbtableview the Optionsview property of the Focusrect is false can not see the dashed box, that is, the border to get the focus line
4, in the case of multiple selection, according to the above mentioned sorting and filtering will appear, sorted after the focus to the first row but not checked (the background color is white), and after the elimination of the filter focus to the first row and the default first row is selected (the background color is blue or other operating system theme color), so it is inconsistent, Interim solution:
are only positioned to the first row and do not select any rows, just a refresh adjustment to the filtered event code:
[Delphi]View PlainCopy
- Var
- Filter:tcxdatafiltercriteria;
- Begin
- With Sender as tcxdatafiltercriteria do
- if IsEmpty Then
- begin
- Cxgrdtvgrid1dbtableview1. Datacontroller. DataSet. Active: = False;
- Cxgrdtvgrid1dbtableview1. Datacontroller. DataSet. Active: = True;
- end;
Cxgrid to the first line (single and multiple selection) after de-filtering and sorting