Hi Oleksandr,
Sorry for the delay of response.
We can achieve your requirement by using
following script lines to update the datasource with changed JSON Collection :
<script language="javascript" type="text/javascript">
function
addRecord(sender, args) {
var obj = $find('Grid1').jsonModeMgr.get_dataSource();
var newrow = obj[0];
newrow.CustomerID = "OPOP"
obj.splice(0,
0, newrow);
$find('Grid1').jsonModeMgr.set_dataSource(obj);
}
function
removeRecord(sender, args) {
var obj = $find('Grid1').jsonModeMgr.get_dataSource();
obj.splice(0,1);
$find('Grid1').jsonModeMgr.set_dataSource(obj);
}
</script>
<div id="addRemoveRecord">
<input type="button" name="Add a Record" value="Add a Record" onclick="addRecord()" />
<br />
<br />
<input type="button" name="Remove a Record" value="Remove a Record"" onclick="removeRecord()"
/>
</div>
Here we have added two buttons one button to add a new row
"Add a Record" and another to delete the first row "Remove a
Record".
$find('Grid1').jsonModeMgr.get_dataSource() - gets the
current datasource.
find('Grid1').jsonModeMgr.set_dataSource(obj) - sets
the datasource for the grid with current json collection.
We have created a sample for your convenience. The same can
be downloaded from the following link :
EditingSample.zip
Please let us know if you have any other concerns.
Regards,
Gowri S.