Server Side Filtering

I have a kanban board which has a huge number of records. I have implemented server-side paging how can I add server-side filtering.

1 Reply

AP Arun Palaniyandi Syncfusion Team May 17, 2018 11:17 AM UTC

Hi Musab, 

Thanks for contacting Syncfusion support.   

Query :”how can I add server-side filtering.” 

Yes, You can achieve this requirement by binding a simple AJAX call to the server side and then done the filtering using the LINQ and send it to the view. Then on AJAX success get the JSON data and update it as the datasource to the Kanban via setmodel.  Please refer the code below 


View: 
 
// use an external button click to filter with ajax 
 
@(Html.EJ().Button("fliterbtn").Text("click to filter").Width("auto").ClientSideEvents(ce=>ce.Click("onClick"))) 
 
<script type="text/javascript"> 
 
    function onClick(e) { 
 
        $.ajax({ 
            url: '@Url.Action("FilterKanbanData", "Kanban")', 
            data: { searchstring: "RequestJoinAccepted" }, // send the filter key, here I am filtering the datas in which the status in RequestJoinAccepted 
 
            type: 'POST', 
            dataType: "json", 
            success: function (response) { 
                var obj = $("#Kanban").ejKanban("instance"); 
                obj.option("dataSource", response); // set the filtered result as the Kanban new datasource            
 
            } 
        }); 
 
 
    } 
 
    </script> 
 
Controller: 

  public ActionResult FilterKanbanData(string searchstring) 
        {   
            var Data = db.Tasks.ToList(); 
 
            IEnumerable searchresult = from n in Data where n.Status.Contains(searchstring) select n; // Filtering based on the Filter word using Linq 
 
            return Json(searchresult, JsonRequestBehavior.AllowGet); 
 
        }   
 



Please refer to the following sample:  

 
Please check the shared sample and if the sample still not meet your requirement or if we misunderstood your query means, please send us more information so that we will provide a prompt solution.         
         
Regards,         
Arun P.     


Loader.
Up arrow icon