This is a migrated thread and some comments may be shown as answers.

Grid Refresh Issue when data list is empty

1 Answer 378 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Purush
Top achievements
Rank 1
Purush asked on 15 Jun 2012, 01:49 PM
Hi,

I'm trying to resolve the refreshing issue with grid while setting data using Datasource.data() method. Grid refreshes fine when data list contains atleast one record , if data list contains empty list Grid renders the cached data. in this case very first set of data list assigned to Datasource.

setData:

 

function (selector, datalist, emptyOptions) {

 

var grid = $(selector).data("kendoGrid");

 

if (!grid) return false;

 

var len = datalist.length || 0;

 

if (grid.dataSource) {

grid.dataSource._pristine = datalist;

grid.dataSource._total = datalist.length || 0;

grid.dataSource.data(datalist);

}

 

else {

grid.dataSource =

 

new kendo.data.DataSource({ data: datalist, total: len });

}

 

this.resize(selector, emptyOptions);

},

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 19 Jun 2012, 08:37 AM
Hi Purush,

I am not sure if I understood the problem correctly. I tested this case with the on line demos - tried to pass an empty array to the data method and everything worked as expected, e.g. the grid had no data.
$("#grid").data("kendoGrid").dataSource.data([])

Could you please provide more information about what you are trying to achieve? Is it possible to reproduce the problem in a jsFiddle, so I can test and examine it in details? Please provide such example and I will check it right away.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Purush
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or