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

Grid search returning rows without matches.

I have a data grid that is matching on fields that I'm not displaying in the grid results.
For example If I have the below class and grid, could I have the search ignore ImageURL?
public class SlideKit{
public string Title { get; set; }
public int Id { get; set; }
public string ImageURL { get; set; }
}
and I the grid:
@(Html.EJ().Grid("pifPresentationSearchResults")
.Datasource((IEnumerable<object>)Model.SlidekitList)
.ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Search); }); })
.AllowScrolling()
.AllowSelection(false)
.ScrollSettings(scroll => { scroll.Height(380); })
.RowTemplate("#templateData")
.Columns(col =>
{
col.HeaderText("").Width("25px").Add();
col.HeaderText("PRESENTATION DETAILS").Add();
})
)

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team November 16, 2016 11:20 AM UTC

Hi Patrick, 

Thanks for contacting Syncfusion support. 

Normally search operation perform the searching in Grid based on the given data source. If we give only 4 fields for presentation details and performing the search operation in Grid, then it searches the whole data source and returned matches rows in all fields instead of given 4 fields.  
So the input value has should be in result of the matched rows in any other fields. We can check the result the data after searching by call the getCurrentViewData() method in console window. We suspect this is cause of the issue and suggest you to use refer to the following code example for resolve this issue, 
Code example
@(Html.EJ().Grid<EmployeeView>("RowTemplate") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
        .AllowScrolling() 
        .ScrollSettings(scroll => { scroll.Height(380).Width(500); }) 
        .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Search); }); }) 
        .RowTemplate("#templateData") 
        .ClientSideEvents(e=>e.ActionBegin("ActionBegin").ActionComplete("ActionComplete")) 
        .Columns(col => 
        { 
           . . . 
        }) 
    ) 
 
<script> 
 
     
    function ActionBegin(args) { 
        if (args.requestType == "searching") 
            this.model.searchSettings.fields = ["LastName", "FirstName", "Title"]; // here we can search the Grid with given fields. So it will returned the results only matched items. 
    } 
</script> 

We have also created a sample for your convenience which can be download from following link, 
If you still face the same issue, then could you please provide following details? 
1)      Essential studio version details 
2)      Issue replication procedure. 
3)      Screenshot of Grid with search input. 
4)      Screenshot of search results. 
5)      A sample if possible or modify the given sample as issue reproducible. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Live Chat Icon For mobile
Up arrow icon