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

Default Filter Operator Type Change

I am trying to change the default filter operator of a string type column with no sucsess using the Html helper syncfuison has provided. 
i have the following: 

    @(Html.EJ().DataManager("FlatData").URL(Url.Action("NscDataSource", "Home", null, Request.Url.Scheme)).Adaptor(AdaptorType.UrlAdaptor))
    @(Html.EJ().Grid<NscTicketInfo>("Grid")
        .DataManagerID("FlatData")
        .AllowPaging()
        .AllowSorting()
        .AllowMultiSorting()
        .AllowFiltering()
        .AllowSearching()
        .ContextMenuSettings(contextMenu =>
        {
            contextMenu.EnableContextMenu();
        })
        .Columns(c =>
        {
            c.Field(f => f.ID).Width(60).Add();
            c.Field(f => f.GlobalTicket.TicketDisplayID).Width(60).Add();
            c.Field(f => f.Customer).Width(80).Add();
            c.Field(f => f.Contact).Width(150).Add();
            c.Field(f => f.Phone1).Width(120).Add();
            c.Field(f => f.Fax).Width(120).Add();
            c.Field(f => f.Email).Width(150).Add();
            c.Field(f => f.Address).Width(150).Add();
            c.Field(f => f.State).Width(60).Add();
            c.Field(f => f.Zip).Width(60).Add();
            c.Field(f => f.CategorizationLink).Width(50).Add();
            c.Field(f => f.SourceLink).Width(40).Add();
            c.Field(f => f.TraceID).Width(200).Add();
        })
        .FilterSettings(Sett => Sett.FilterBarMode(FilterBarMode.OnEnter)
            .FilteredColumns(col => col.Field("Customer").Operator(FilterOperatorType.Equals).Add()))
        .SortSettings(sort => sort.SortedColumns(col => col.Field("ID").Direction(SortOrder.Ascending).Add()))
        .PageSettings(p => p.PageSize(30).EnableQueryString())
        .ClientSideEvents(e => e
            .Create("create")
            .ActionComplete("onComplete")
            .ActionBegin("actionBegin")
          ))


the highligheted lines are what i expect to change the defualt setting but i cannot figure out what i am missing. The grid will still post a dataManager with a where clause that has a startswith predicate. 

Thank You
DIamond

4 Replies

JK Jayaprakash Kamaraj Syncfusion Team December 23, 2016 09:22 AM UTC

 
Hi Diamond, 
 
Thank you for contacting Syncfusion support. 
 
We have already discussed the same in following knowledge base document. 


Regards, 
 
Jayaprakash K. 



DI Diamond December 23, 2016 02:05 PM UTC

Awesome yes i did also find this piece of code. cool.
How do i tie that to an individual column? i do not want to change all of the defaults only one particular column.


DI Diamond December 23, 2016 05:57 PM UTC

You can use the currentFilteringColumn  property to change the default filter of a particular column instead of changing all of the defaults


    function actionBegin(args) {
        if (args.requestType == "filtering" && args.currentFilteringColumn == "Customer")
        {
            args.currentFilterObject[0].operator = "equal";
        }  


JK Jayaprakash Kamaraj Syncfusion Team December 27, 2016 09:15 AM UTC

Hi Diamond,  
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.   
 
Regards,  
 
Jayaprakash K. 


Loader.
Live Chat Icon For mobile
Up arrow icon