I'm currently evaluating Kendo UI, and I've found a problem I can't get past. I can't manually update the page value on my datasource.
The code is very simple. When I click a button, I retrieve the value for page off the datasource for a combobox. I increment it by 1, and then I set the new value on the datasource. The problem is that it is not actually updating the page.
$(document).ready(function(){
var MyDataSource, $MyComboBoxRef, $dataMyComboBox;
MyDataSource = new kendo.data.DataSource({
batch:true,
serverFilter: true,
serverPaging: true,
pageSize: 10,
schema: {
total:"total",
data: function(response){
return response.options
}
},
transport: {
read: {
dataType: "json",
url: "/MyService",
type: "POST",
async: false,
data: function(options) {
var MyComboBox = $("#MyComboBox").data("kendoComboBox"),
query = MyComboBox.text(),
$dataMyComboBox = $dataMyComboBox;
query = query == null || query == "" ? "*" : query;
return {
action: "QueryMyComboBoxOptions",
query: query,
page: options.page,
page_limit: options.pageSize
};
}
}
}
});
$MyComboBoxRef = $("#MyComboBox");
$MyComboBoxRef.kendoComboBox({
autoBind:false,
minLength: 21,
dataSource: MyDataSource,
dataTextField: "text",
dataValueField: "id"
});
$dataMyComboBox = $MyComboBoxRef.data("kendoComboBox");
$('#submitBtn').click(function(){
var page = $("#MyComboBox").data("kendoComboBox").dataSource.page();
alert("Page: " + page);//Page: 1
page = page +1;
alert("Page: " + page);//Page: 2
$("#MyComboBox").data("kendoComboBox").dataSource.page(page);//MyService is pinged, but page is passed back with a value of 1?
page = $("#MyComboBox").data("kendoComboBox").dataSource.page();
alert("Page: " + page);//Page: 1 .. ? Why isn't it updateing?'
});
});
The code is very simple. When I click a button, I retrieve the value for page off the datasource for a combobox. I increment it by 1, and then I set the new value on the datasource. The problem is that it is not actually updating the page.
$(document).ready(function(){
var MyDataSource, $MyComboBoxRef, $dataMyComboBox;
MyDataSource = new kendo.data.DataSource({
batch:true,
serverFilter: true,
serverPaging: true,
pageSize: 10,
schema: {
total:"total",
data: function(response){
return response.options
}
},
transport: {
read: {
dataType: "json",
url: "/MyService",
type: "POST",
async: false,
data: function(options) {
var MyComboBox = $("#MyComboBox").data("kendoComboBox"),
query = MyComboBox.text(),
$dataMyComboBox = $dataMyComboBox;
query = query == null || query == "" ? "*" : query;
return {
action: "QueryMyComboBoxOptions",
query: query,
page: options.page,
page_limit: options.pageSize
};
}
}
}
});
$MyComboBoxRef = $("#MyComboBox");
$MyComboBoxRef.kendoComboBox({
autoBind:false,
minLength: 21,
dataSource: MyDataSource,
dataTextField: "text",
dataValueField: "id"
});
$dataMyComboBox = $MyComboBoxRef.data("kendoComboBox");
$('#submitBtn').click(function(){
var page = $("#MyComboBox").data("kendoComboBox").dataSource.page();
alert("Page: " + page);//Page: 1
page = page +1;
alert("Page: " + page);//Page: 2
$("#MyComboBox").data("kendoComboBox").dataSource.page(page);//MyService is pinged, but page is passed back with a value of 1?
page = $("#MyComboBox").data("kendoComboBox").dataSource.page();
alert("Page: " + page);//Page: 1 .. ? Why isn't it updateing?'
});
});