Cxgrid to the first line (single and multiple selection) after de-filtering and sorting

Source: Internet
Author: User

Cxgrid to the first line (single and multiple selection) after de-filtering and sortingoriginal October 06, 2013 18:42:24
    • 2107

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
  1. Var
  2. Filter:tcxdatafiltercriteria; //Define Filter Object
  3. Begin
  4. With Sender as tcxdatafiltercriteria do
  5. If IsEmpty then //action filter triggers a filter event to determine if the filter is empty, that is: whether to cancel the filter
  6. begin
  7. Cxgrdtvgrid1dbtableview1. Datacontroller. Focusedrowindex: = 0; //Focus position to first row
  8. 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
  1. Var
  2. Filter:tcxdatafiltercriteria;
  3. Begin
  4. With Sender as tcxdatafiltercriteria do
  5. If IsEmpty then //action filter triggers a filter event to determine if the filter is empty, that is: whether to cancel the filter
  6. begin
  7. Cxgrdtvgrid1dbtableview1. Optionsselection.  MultiSelect: = False;
  8. Cxgrdtvgrid1dbtableview1. Datacontroller. Focusedrowindex: = 0; <span style= "font-size:14px;font-family:arial;" >//focus to First line </span>
  9. Cxgrdtvgrid1dbtableview1. Optionsselection.  MultiSelect: = True;
  10. 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
  1. Var
  2. Filter:tcxdatafiltercriteria;
  3. Begin
  4. With Sender as tcxdatafiltercriteria do
  5. if IsEmpty Then
  6. begin
  7. Cxgrdtvgrid1dbtableview1. Datacontroller. DataSet.  Active: = False;
  8. Cxgrdtvgrid1dbtableview1. Datacontroller. DataSet.  Active: = True;
  9. end;


Cxgrid to the first line (single and multiple selection) after de-filtering and sorting

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.