I have the following function that resets grid data:
function ReSetGridDataSource(grid, data, sort, emptyMessage) {
if(grid.length > 0) {
if(grid.substring(0, 1) !== '#') {
grid = '#' + grid;
}
var grd = $(grid).data("kendoGrid");
var ds = new kendo.data.DataSource();
ds.data(data);
if(sort !== null && isArray(sort)) {
ds.sort(sort);
}
if(emptyMessage !== null && emptyMessage !== undefined) {
if(emptyMessage.length > 0 && ds.total() === 0 && $("#emptyMessageRow_" + grid) == null) {
var colCount = $(grid).find('.k-grid-header colgroup > col').length;
$(grid).append('<tr id="emptyMessageRow_' + grid + '" class="kendo-data-row"><td colspan="' + colCount + '" style="text-align:center; font-family:arial; font-size:24px;"><b>' + emptyMessage + '</b></td></tr>');
}
}
else {
try {
$("#emptyMessageRow_" + grid).remove();
}
catch(err) {}
}
grd.setDataSource(ds);
grd.refresh();
}
}
The data is a JSON array of objects. The application is designed specifically for an IPAD, after making changes to the data the above function is called, the grid content area blanks out, if I tap the blank area several times the data reappears, if I leave the grid alone (do not tap the blank area) the data never reappears.
I have alter the function for testing where the data is not refreshed if the grid has been previously bound, the content are remains visible.
function ReSetGridDataSource(grid, data, sort, emptyMessage) {
if(grid.length > 0) {
if(grid.substring(0, 1) !== '#') {
grid = '#' + grid;
}
var grd = $(grid).data("kendoGrid");
var ds = new kendo.data.DataSource();
ds.data(data);
if(sort !== null && isArray(sort)) {
ds.sort(sort);
}
if(emptyMessage !== null && emptyMessage !== undefined) {
if(emptyMessage.length > 0 && ds.total() === 0 && $("#emptyMessageRow_" + grid) == null) {
var colCount = $(grid).find('.k-grid-header colgroup > col').length;
$(grid).append('<tr id="emptyMessageRow_' + grid + '" class="kendo-data-row"><td colspan="' + colCount + '" style="text-align:center; font-family:arial; font-size:24px;"><b>' + emptyMessage + '</b></td></tr>');
}
}
else {
try {
$("#emptyMessageRow_" + grid).remove();
}
catch(err) {}
}
grd.setDataSource(ds);
grd.refresh();
}
}
The data is a JSON array of objects. The application is designed specifically for an IPAD, after making changes to the data the above function is called, the grid content area blanks out, if I tap the blank area several times the data reappears, if I leave the grid alone (do not tap the blank area) the data never reappears.
I have alter the function for testing where the data is not refreshed if the grid has been previously bound, the content are remains visible.