Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert kendo filter object to string

When applied filter in kendo grid i am getting filter as object like below

filter :  { filters : [], logic : "and"}

But in some kendo examples filter is displaying like

   filter : "producatname~eq~test"

How to change filter from object to string

like image 815
Arjun Avatar asked Jan 01 '26 08:01

Arjun


1 Answers

Assuming you are writing JavaScript code in a web page and want to convert the filter data to a string suitable for sending or saving, you can use transport.parameterMap to convert filters to a string.

const grid = $("#grid").data("kendoGrid");
const parameterMap = grid.dataSource.transport.parameterMap;
const filterString = parameterMap({filter: grid.dataSource.filter()}).filter

On the MVC side you can then use Kendo.Mvc.Infrastructure.FilterDescriptorFactory.Create(string) to parse the string.

like image 118
Jaroslav K Avatar answered Jan 05 '26 06:01

Jaroslav K



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!