I have a datagrid inside a Kendo Mobile app.
I am able to populate the grid with data on the initial page view but subsequent views continue to "add" to the datasource array dispite (all) my efforts to clear it prior to binding.
I am using AJAX(obviously) and during my onSuccess callback, I clear the original source varable (array) ,
then set it to the data returned from ajax and finally call my loadGrid routine to define the KendoGrid.
I have even tried passing in the refreshed data array but I know it is still bound to the grid itself.
I have also tried setting the grids datasource to null, and [] but it just keeps appending data and doesn't clear it.
I can see my grids pager goping from 5 pages to 10.
Is there a simple way to remove the data / binding?
here is psuedo code:
var CustData = [ ];
function onSuccess(data,status)
{
CustomerData.length=0;
CustomerData = [];
CustomerData = data.d;
loadgrid(CustomerData );
}
function loadGrid(custData) {
$("#grid").kendoGrid({ { data: [ ] } }); // futile attempt to clear
$("#grid").kendoGrid({
{ data: custData, pageSize: 20 }
// dataSource: new kendo.data.DataSource({data: custData})
});
}
I am able to populate the grid with data on the initial page view but subsequent views continue to "add" to the datasource array dispite (all) my efforts to clear it prior to binding.
I am using AJAX(obviously) and during my onSuccess callback, I clear the original source varable (array) ,
then set it to the data returned from ajax and finally call my loadGrid routine to define the KendoGrid.
I have even tried passing in the refreshed data array but I know it is still bound to the grid itself.
I have also tried setting the grids datasource to null, and [] but it just keeps appending data and doesn't clear it.
I can see my grids pager goping from 5 pages to 10.
Is there a simple way to remove the data / binding?
here is psuedo code:
var CustData = [ ];
function onSuccess(data,status)
{
CustomerData.length=0;
CustomerData = [];
CustomerData = data.d;
loadgrid(CustomerData );
}
function loadGrid(custData) {
$("#grid").kendoGrid({ { data: [ ] } }); // futile attempt to clear
$("#grid").kendoGrid({
{ data: custData, pageSize: 20 }
// dataSource: new kendo.data.DataSource({data: custData})
});
}