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.
Unfortunately, activation email could not send to your email. Please try again.

How to make a custom filter on month ?

Thread ID:

Created:

Updated:

Platform:

Replies:

127121 Oct 27,2016 04:43 AM Feb 17,2017 08:06 AM WinRT 3
loading
Tags: SfDataGrid
Elie
Asked On October 27, 2016 04:43 AM

Hello,

I have a GridDateTimeColumn I want to make a custom Filter, which I can filter on the month's date.
On the filter, we see "January, February..."

How to make this, please ?


I made this, but I failed to filter the items.

 void sfDataGrid_FilterItemsPopulated(object sender, GridFilterItemsPopulatedEventArgs e)
        {
            if (e.Column.MappingName == "ShippedDate")
            {
                var itemsSource = e.ItemsSource as List<FilterElement>;
                itemsSource.Clear();
              
                itemsSource.Add(new FilterElement { ActualValue = new DateTime(2000, 1, 1), DisplayText = "January", IsSelected = true });
                itemsSource.Add(new FilterElement { ActualValue = new DateTime(2000, 2, 1), DisplayText = "February", IsSelected = true });
                itemsSource.Add(new FilterElement { ActualValue = new DateTime(2000, 3, 1), DisplayText = "March", IsSelected = true });
            }
        }


Regards

Sivakumar R [Syncfusion]
Replied On October 28, 2016 12:51 PM

Hi Elie, 
 
We have prepared the sample to filter based on month and year. Please find the sample from below location, 
 
Thanks, 
Sivakumar 


Djooleean
Replied On February 16, 2017 09:01 AM

Hi guys,

when I run the sample, it doesn't work.
FilterControl's items are well formatted (ie: "March 2009") but when I filter, no more value is displayed on the grid...

So filter items are good but the filtering method doesn't work anymore (see images).
Any idea ?
thanks, Julien

selecting filter



after filter


Jai Ganesh S [Syncfusion]
Replied On February 17, 2017 08:06 AM

Hi Elie,  
 
The attached sample working fine and also the filtering also working as expected in our side, 
 
 
 
 
 
 
Could you please check this in your side and please share in which essential studio you have used in your application? This would be more helpful for us to analyze further. 
 
Regards, 
Jai Ganesh S 
 


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.

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.

;