.SortSettings(s => s.SortedColumns(Model.SortedColumns))
.FilterSettings(f => f.FilteredColumns(Model.FilteredColumns))
We have analyzed the reported query and we have considered this query “Setting filteredColumns using MVC helpers” as a bug and a support incident has been created under your account to track the status of this issue. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
As of now, we can achieve your requirement by getting the filteredColumns from the server side and pushing it to the grid filterCollections in the Load event of the grid. Please refer the below code snippet.
<div style="margin-top:30px"> @(Html.EJ().Grid<object>("Grid") .Datasource(Model.data) .AllowFiltering() . . . . .PageSettings(page=>page.CurrentPage(3).PageSize(6).PageCount(5)) //for customizing the paging functionality .SortSettings(sort=>sort.SortedColumns(so=>so.Field("Freight").Add()))//for initial sorting .GroupSettings(group => group.ShowGroupedColumn(false).GroupedColumns(co => { co.Add("EmployeeID"); })) //for initial grouping . . . . .ClientSideEvents(eve=>eve.Load("load")) ) </div>
<script type="text/javascript"> //load event of the grid function load(args){ var filterData = @Html.Raw(Json.Encode(Model.FilteredColumns)); //get the filterCollections from the server side var filterOp; for(var i=0;i<filterData.length;i++){ switch(filterData[i].Operator){ //code to convert the filter operator case 0: filterOp = "startswith" break; . . . . } this.model.filterSettings.filteredColumns.push({ field: filterData[i].Field, operator: filterOp, value: filterData[i].Value, matchcase: filterData[i].MatchCase, predicate: filterData[i].Predicate }); //pushing the filter list from server side to the grid filterCollections } } |