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.