Reputation: 11984
I am using kendo grid and i am creating the grid in document.ready
function.Initially while creating the grid it does not have a read.But after selecting a value i have to populate the grid with certian values from the database.So i want to trigger the read of kendo grid after selecting the value.So at that time i want to give the path for read action.Is it possible??
For exampe
in the document.ready i am creating the datasource for grid like this
dataSource = new kendo.data.DataSource({
serverPaging : true,
serverSorting : true,
serverFiltering : true,
serverGrouping : true,
serverAggregates: true,
transport: {
read: {
},
update: {
}
}
});
And when the user selects a value from a field i have to set the url fro read Say name is the field where user selects a value So
$("#name").change(function(){
//set read action here and read data for the grid
});
Upvotes: 0
Views: 3038
Reputation: 9167
var _theUrl;
dataSource = new kendo.data.DataSource({
serverPaging: true,
serverSorting: true,
serverFiltering: true,
serverGrouping: true,
serverAggregates: true,
transport: {
read: {
url: function() { return _theUrl; }
},
update: {
}
}
})
$("#name").change(function(){
_theUrl = "URLHere.aspx";
dataSource.read();
});
Upvotes: 3