Hello,
I am attempting to use a Listview with serverPaging that has custom filtering applied to it. What I am seeing is when I apply a filter, the intial result set is coming back correct. When I attempt to change the page, I am seeing two dataSource requests. The first request has the correct querystring arguments passed, and the second has no arguments set.
How can I get the desired functionality without the extra datasource request? Code is below.
I am attempting to use a Listview with serverPaging that has custom filtering applied to it. What I am seeing is when I apply a filter, the intial result set is coming back correct. When I attempt to change the page, I am seeing two dataSource requests. The first request has the correct querystring arguments passed, and the second has no arguments set.
How can I get the desired functionality without the extra datasource request? Code is below.
$("#user-Search").kendoDropDownList({
autobind: false,
enabled: true,
optionLabel: "All",
dataTextField: "text",
dataValueField: "value",
dataSource: userDataSource,
edit: function (e) {
var ddl = e.container.find('[data-role=dropdownlist]').data('kendoDropDownList');
if (ddl) {
ddl.open();
}
},
change: function () {
initGrid();
}
});
function initGrid() {
var ds = getDataSource();
var History = $("#listView").kendoListView({
dataSource: ds,
template: kendo.template($("#template").html()),
autoBind: false,
pageable: true
});
$("#pager").kendoPager({
dataSource: ds,
empty: "No Items to Display",
autoBind: false
});
}
function getDataSource() {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/Services/TitleHistory.ashx?publishedid=" + $("#SearchHistory")[0].value + "&startDate=" + $("#datestart")[0].value + "&endDate=" + $("#dateend")[0].value + "&filterUser=" + $("#user-Search")[0].value,
dataType: "jsonp"
},
serverOperation:false
},
serverPaging: true,
schema: {
total: function (response) {
if (response[0]) {
return response[0].total;
}
else {
return 0;
}
},
model: {
id: "EventType",
fields: {
EventType: { editable: false, nullable: true },
Details: { editable: false, nullable: true },
Comment: { editable: false, validation: { required: true } },
User: { editable: false, validation: { required: true } },
EventDate: { validation: { required: true }, type: "date", format: "{0:MM-dd-yyyy}" }, editable: false,
Title: { editable: false, nullable: false },
UserId: { editable: false, nullable: false },
PublishedId: { editable: false, nullable: false, }
},
}
},
pageSize: 5
});
dataSource.fetch();
return dataSource;
}