0

Is there a way we can delete rows from a wijmo grid running within a loop and refresh the grid with new data. I tried with the following approach, I can see the rows getting deleted while debugging but after the loop ends the grid is refreshed with old set of data.

   self.delete = function (obj, event) {

            var pagesize = $("#pageDisplay :selected").val();// 5
            var pageSizeDiff = defaultPageSize - pagesize;//5
            var $grid = $("#Grid");
            var newData = $grid.wijgrid("data");// array of 10 objects
            var i = 0;
            while (i < pagesize) {
                newData.splice(pageSizeDiff, 1);// delete from 5th row
                $grid.wijgrid("data", newData);

                //refresh grid
                $grid.wijgrid("ensureControl", true);
                i++;
            };                
        };
user2904389
  • 43
  • 1
  • 7

1 Answers1

0

I am not sure why you are setting the new data in the loop. Ideally, you should delete the rows in the loop and then, set the new data.

Ashish
  • 594
  • 1
  • 6
  • 12
  • I tried setting new data after the loop but it's the same result. The grid gets refreshed with the same old data. – user2904389 Jul 13 '15 at 13:39