Mantain selection when filtering

Hello,

Is it possible to matain the selection in an SfDataGrid after programatic filtering? Now when that is done what keeps selected is the row but not the item. If the row number displays another item, it is the new item what it is selected, instead the old one.

Thanks in advance.

5 Replies

VS Vijayarasan Sivanandham Syncfusion Team March 5, 2020 05:34 PM UTC

Hi David García 
Thank you for contacting Syncfusion support.

We have analyzed the reported query “Maintain selection when filtering” at our end. We suspect that your using view filtering in programmatic filter.
Your requirement can be achieved by enabling the RefreshFilter(true) property in SfDataGrid. Please refer the below code snippet, 
  
private void btnProgrammaticFilter_Click(object sender, RoutedEventArgs e) 
        { 
            sfDataGrid1.View.Filter = FilterRecords; 
            sfDataGrid1.View.RefreshFilter(true); 
        } 
  
Please find sample for the same from the link below, 
 
 
We hope this helps. Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S  



DG David García March 5, 2020 06:49 PM UTC

Hello,

Thanks for the reply back and the example. I'm using View Filtering, correct, but the provided example works as expected except for something that not sure if it is the normal behavior or should be other way. I attached a modified example to show what I mean.

If I select some rows and then apply a filtering when I clear the filtering the rows are not selected anymore. If the filtered items include a previously selected item then it keeps selected when clear the filtering, but if none previously selected items are included in the filtering, then when clear the filtering the first row in the grid (that wasn't selected before) is now selected.

Don't know if that is a normal behavior or it is a bug in the filtering process.

Thanks in advance.

Attachment: Sample1226510665Modified_e26ec7d3.zip


VS Vijayarasan Sivanandham Syncfusion Team March 6, 2020 02:31 PM UTC

Hi David García,

Thanks for the update.

By default, when applying view filtering selected items maintained if filter items contains previously selected item. If not first row maintain as selected item. Applying filter in SfDataGrid when Selected Item not available in filtered value then selection should be cleared and selection set as first row of SfDataGrid. This is a default behavior of our SfDatGrid. 
If you want to maintain the previously selected item, please let us know we will check the feasibility to achieve this and provide the further details on this. 
Regards, 
Vijayarasan 



DG David García March 6, 2020 03:02 PM UTC

Hi,

Again thank you for the reply back.

It would be interesting to have the option that the selected items are mantained even when done a filtering as when there is a long collection of items search through them to select a few can be difficult if not filter them.

I was thinking about open a feedback on the control to ask for the possibility to include this feature in a future release of the control.

Thanks again.


VS Vijayarasan Sivanandham Syncfusion Team March 10, 2020 12:58 PM UTC

Hi David García, 
 
 
 
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then. 
 
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. 
  
We are closing this incident now. You can also communicate with us regarding the open features any time using our Feature Report page.  
  
  
 
Regards,
Vijayarasan S 


Loader.
Up arrow icon