I'm using Kendo UI grid in my project to build a orders list, it has a data-source that loads all the orders immediately with an ajax request and it works on them (filtering, ordering, paging) locally with no additional requests.
This is the code i've used to set it up:
$("#layby-list").kendoGrid({
columns: [
{
title: "Order date",
field: 'order_d',
filterable: {cell: {operator: "eq", showOperators: false}},
format: "{0:dd/MM/yyyy}"
},
{
title: "Order number",
field: 'order_n',
filterable: {cell: {operator: "eq", showOperators: false}},
},
{
title: "Customer",
field: 'customer',
filterable: {cell: {operator: "startswith", showOperators: false}}
}
],
filterable: {
mode: "row"
},
selectable: "row",
sortable: true,
resizable: true,
navigatable: true,
pageable: {
pageSize: 10
},
groupable: true,
dataSource: {
transport: {
read: {
url: baseUrl,
dataType: "json",
type: "POST",
data: {
action: 'loadOrders'
}
}
},
schema: {
data: "data",
total: "total",
type: "json",
model: {
fields: {
order_d: {type: 'date'},
order_n: {type: 'number'},
customer: {type: 'string'}
}
}
}
}
});
This works very good except when i try to filter the "customer" column, since that filter is an autocomplete it performs exactly the same request executed to load the grid to show all the options, so the question is: is it possible to avoid that request by sharing data between the grid and its filters?