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. Image for the cookie policy date
close icon

Changing default filter type in GridDynamic filter

I am using GridDynamicFilter for my grouping grid and when i enter text in filter box and click on enter, it is searching based on "Starts With", but i need to search it based on "Equals" by default. Is there any way to do this.

I am using 9.3.0.61

My Code:
            GridDynamicFilter filter = new GridDynamicFilter();
            filter.ApplyFilterOnlyOnCellLostFocus = true;
            filter.WireGrid(this);


6 Replies

AS Athiram S Syncfusion Team March 5, 2013 10:10 AM UTC

Hi Robin,

Thanks for your interest in Syncfusion Products.

You can make use of the following code to achieve the result:

  GridTableFilterBarExtCellRenderer rend = this.gridGroupingControl1.TableControl.CurrentCell.Renderer as GridTableFilterBarExtCellRenderer;
RecordFilterDescriptor filter = e.Item as RecordFilterDescriptor;
 filter.Expression = "[" + filter.MappingName + "]" + " " + "Equals" + " " + "'" + rend.TextBox.Text + "'";

Please let me know if you have any concerns.

Regards,
Athiram S



RT Robin Tanner March 5, 2013 10:50 AM UTC

Thanks for the reply Athiram.
But in which event should I write this code?


AS Athiram S Syncfusion Team March 5, 2013 11:35 AM UTC

Hi Robin,

Sorry for inconvenience.

You need to make use of the code in "RecordFilters.Changing"event and achieve the results.

Please let me know if you have any concerns.

regards,
Athiram S





RT Robin Tanner March 5, 2013 12:44 PM UTC

Thanks Athiram
In my case this.TableControl.CurrentCell.Renderer is always null. Do I need to initiate it ?


RT Robin Tanner March 6, 2013 01:43 PM UTC

This worked for me. Thank you very much.


AS Athiram S Syncfusion Team March 7, 2013 12:37 PM UTC

Hi Robin,

Thanks for your update.

We are glad to know that the issue if fixed at your end. If you face any other issues , please open a new forum.

Regards,
Athiram S


Loader.
Live Chat Icon For mobile
Up arrow icon