Searchsettings

Greetings,

Looking for an example on how to set the searchsettings on a grid. I've been scouring the documentations for two days now to no avail. 




Thank you in advance

2 Replies

MB Martha Bailey November 21, 2017 08:51 PM UTC

Created a ticket here.


FS Farveen Sulthana Thameeztheen Basha Syncfusion Team December 1, 2017 12:18 PM UTC

Hi Bradley, 
 
Query :- how to set the searchsettings on a grid. 
 
You can give the fieldNames and Key value that you are going to be search on the Fields using  Field and Key property of the searchSettings. Please refer to the API link:- 
 
 
Refer to the code example:- 
 
<div class="col-md-12"> 
            @(Html.EJ().Grid<UserModel>("MyGrid") 
                            .Datasource(ds => ds.Json(Model.ToList()).CrossDomain(true).RemoveURL(Url.Action("Remove", "Home")).UpdateURL(Url.Action("ToggleManager", "Home")).Adaptor(AdaptorType.RemoteSaveAdaptor)) 
                            .AllowSearching() 
                            .SearchSettings(search => 
                              { 
                                  search.Fields(field => 
                                   { 
                                       field.Add("UserID"); 
                                       field.Add("UserName"); 
                                   }); 
                                  search.Key("Alex"); 
                              }) 
                            .Columns(col => 
                            { 
                                col.Field("UserID").Visible(false).IsPrimaryKey(true).Add(); 
                                col.Field("UserName").HeaderText("Worker's full name").TextAlign(TextAlign.Left).Width(20).Add(); 
                            }) 
            ) 
        </div> 
 
Please get back to us if you need any further assistance. 
 
Regards, 
 
Farveen sulthana T 


Loader.
Up arrow icon