We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filtering

Thread ID:

Created:

Updated:

Platform:

Replies:

150109 Dec 20,2019 02:27 PM UTC Jan 8,2020 02:20 PM UTC WPF 7
loading
Tags: SfDataGrid
Tom
Asked On December 20, 2019 02:27 PM UTC

A couple of questions,

1 - is there a way to change the default item in the Advanced Filter combo from "equals" to "contains".

2 - Using filtering with paging, I can get the view
      grid.View as Syncfusion.UI.Xaml.Grid.GridPagedCollectionViewWrapper;
   which then has a TotelItemCount property, which maintains the total count of items, this is useful as it is correct after the filter is applied. However it is marked as obselete so I wondered what is the correct way now to get the filtered data count?

Thanks, and best wishes to everyone at Syncfusion for the holiday period :)



Saravanan Ayyanar [Syncfusion]
Replied On December 23, 2019 12:58 PM UTC

Hi Tom,   
   
Thank you for using Syncfusion control.   
   
Query 1:   
   
By default, SfDataGrid having three types of advance filter type (Text, Numeric and DateTime). Text filter has "contains filter". Numeric and DateTime filter does not have this “Contains” filter, so could you please share your exact requirement? It will help us to provide the better solution.   
   
Query 2:   
   
We have checked your requirement in our end and marked TotalItemCount property as obsolete for internal purpose in our source. You can get the data count by using the ItemCount property. Please refer to the below code example   
   
Code Snippet:   
var view = this.dataGrid.View as Syncfusion.UI.Xaml.Grid.GridPagedCollectionViewWrapper;   
var count = view.ItemCount;               
   
Please refer to the sample for the same from the link below   
  
Sample Link:    
   
Please let us know, if you require further assistance on this.   
   
Regards,   
Saravanan A. 


Tom
Replied On December 30, 2019 10:55 AM UTC

1 - Yes I meant for the Text chooser - the dropdown boxes are both set as default to "Equals" and I want to change that to "Contains"
2 - thank you, yes ItemCount seems to be the same.
     One slight problem I notice is that, I am using a datapager with the grid. If i have filters set on the grid, and I then change the itemsource to another dataset, the data that is      displayed in the grid is correctly filtered, but this ItemCount / TotalItemCount number is wrong. Ie the grid might display 10 records but the ItemCount is 150 (the      unfiltered coun). I can workaround this by clearing the filters and re-adding them, which forces the ItemCount to be correct again, but it would be great if this step wasn't      necessary.

Saravanan Ayyanar [Syncfusion]
Replied On December 31, 2019 11:17 PM UTC

Hi Tom, 
 
Thanks for your update. 
 
Query 1: 
 
We are currently working on this with high priority. We will update you with further details on January 02, 2020. We appreciate your patience until then.   
 
Query 2: 
 
We are not clear with your query. You are using different event  for to set the item source and to get the item count or you reset the item source in one event, that same event to get the item count ? Can you please provide more details about your query. 
 
It will be helpful for us to investigate further. 
 
Regards, 
Saravanan A. 


Saravanan Ayyanar [Syncfusion]
Replied On January 2, 2020 12:52 PM UTC

Hi Tom, 
 
Thank you for using Syncfusion control. 
 
Query 1: 
 
You can achieve your requirement to change the Contains filter type as default value in GridTextColumn by customize the style of AdvanceFilterControl. Please refer the below code snippet. 
 
<Style x:Key="popupstyleforCustomerName" TargetType="Syncfusion:GridFilterControl"> 
     <Setter Property="FilterMode" Value="Both" /> 
     <Setter Property="AdvancedFilterStyle" Value="{StaticResource advancedfilterstyleforCustomerName}" /> 
</Style> 
 
<Syncfusion:GridTextColumn HeaderText="Customer Name"   FilterPopupStyle="{StaticResource popupstyleforCustomerName}" MappingName="CustomerName" /> 
 
 
Sample Link: 
 
Please let us know, if you require further assistance on this. 
 
Regards, 
Saravanan A.

Tom
Replied On January 3, 2020 11:36 AM UTC

1 - Great, thanks for that

2 - So DataGrid with DataPager. Bind ItemSource in Code. Use a Text Column filter, e.g. limit "Customer Name" to Contains "John", then it displays correctly and the itemcount is correct. However if you now change the ItemSource to another collection, the "John" filter is still applied, and the data in the grid reflects that. However the ItemCount property is the number of items without the filter applied. However if (in code) i just remove and re-add the column filters, the item count property is then correct. Sorry I can't explain it better than that, and the workaround is fine, especially as it is not clear whether one should expect the same filters to be applied when changing the ItemSource anyway.

Saravanan Ayyanar [Syncfusion]
Replied On January 6, 2020 02:09 PM UTC

Hi Tom, 
 
Thank you for your update. 
 
Query 2: 
Currently we are checking your reported scenario. We will validate this and provide you details on January 8, 2020. We appreciate your patience until then. 
 
Regards, 
Saravanan A. 


Saravanan Ayyanar [Syncfusion]
Replied On January 8, 2020 02:20 PM UTC

Hi Tom, 
 
Thank you for using Syncfusion Control. 
 
We are able to reproduce the reported scenario in our end. It occurs since the view is not refreshed after the ItemsSource is set. You can resolve  this by getting the view Item Count from Dispatcher.BeginInvoke method in datagrid. Please refer the below code snippet. 
 
private void Button_Click(object sender, System.Windows.RoutedEventArgs e) 
{ 
    this.sfDataPager.Source = respository.PopulateOrders(10); 
    this.dataGrid.ItemsSource = this.sfDataPager.PagedSource; 
    this.dataGrid.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, 
            new Action(() => 
            { 
                var view = this.dataGrid.View as Syncfusion.UI.Xaml.Grid.GridPagedCollectionViewWrapper; 
                var count = view.ItemCount; 
            })); 
} 
 
 
 
Sample Link: 
 
We hope it helps, please let us know if you need further assistance on this. 
 
Regards, 
Saravanan A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon