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

oldvalues.count = 0 newvalues = null on update following insert

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mitch
Top achievements
Rank 1
Mitch asked on 18 Nov 2014, 08:37 PM
how do you reset a grid, in batch edit mode, to its original state after an update? ie, clear whatever tracked changes it has going on so that if i click save changes again it doesn't still think there are commands to process

when i add an item, save changes, and then edit the same item (or do nothing to it) i get an update command with an oldvalues count of 0 and a null newvalues object. which feels less like an update than a not anything at all. if i could reset the grid after each save changes it wouldn't be an issue

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 21 Nov 2014, 12:46 PM
Hi Mitch,

In order to prevent postback when there are no changes in RadGrid you can use the following approach. Handle the OnCommand client event and check if there are any pending changes in the grid. In case there are no changes -cancel the event. Check out the following code snippet that illustrates the approach:

function onCommand(sender, args) {
    var grid = $find("RadGrid1");
    var batchEditingManager = grid.get_batchEditingManager();
    var masterTable = grid.get_masterTableView();
     
    if (!batchEditingManager.hasChanges(masterTable)) {
        args.set_cancel(true);
    }
}



Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Mitch
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or