Hi Douq,
Can u plz try this...
var _ClientsListDS = null;
$(document).ready(function () {
// Declare data sources and kendo controls
InstanciateDataSources();
InstanciateKendoControls();
// Load listview
_ClientsListDS.fetch();
// Search events handlers
$("#fieldSearch").on('keyup', function (e) {
OnSearch($(this).val());
});
$("#fieldSearch").on('search', function (e) {
OnSearch($(this).val());
})
});
function InstanciateDataSources() {
// This datasource bind the listview
_ClientsListDS = new kendo.data.DataSource({
type: "odata",
serverPaging: true,
serverFiltering: true,
pageSize: 12,
transport: {
read: {
url: ‘your url here ’
dataType: 'json',
}
},
schema: {
model: {
id: "Id"
}
}
});
}
function InstanciateKendoControls() {
// list view
$("#divClientListView").kendoListView({
template: "<div id=${Id} style='width:100%;height:24px;cursor:pointer'><span style='padding-left:9px;line-height:24px;'>${Name}</span></div>",
selectable: 'true',
height: 400,
autoBind: false,
dataSource: _ClientsListDS,
columns: ["Id", "Name"]
});
// list view pager
$("#pager").kendoPager({
autoBind: false,
dataSource: _ClientsListDS
});
}
//----------------------------------------------------------------------------
// Event Handler - Enable list view filtering
//----------------------------------------------------------------------------
function OnSearch(pSearchValue) {
if (pSearchValue)
$("#divClientListView").data("kendoListView").dataSource.filter({ field: "Name", operator: "contains", value: pSearchValue });
else
$("#divClientListView").data("kendoListView").dataSource.filter({});
}