I'm want to insert a new row directly into the client data source doing something like this:
var data = [{ "ID": 1, "Text": "Text1" }, { "ID": 2, "Text": "Text2" }];
var mtv = $find("RadGrid1").get_masterTableView();
var items = mtv.get_dataSource(); // this won't work because is null
//var items = mtv.get_dataItems(); // this is obvious way to do it, but I want to insert a json object
var newItems = items.splice(3, 0, data); // insert object
mtv.set_dataSource(items); // (item actually get's inserted into orginal items,and not newItems - bit result is same either way)
mtv.dataBind();
However:
1) The data source is null - I guess upon rendering it gets reset
2) I can add items to the 'dataItems' array, but I guess this has to be formatted as HTML.
Is it possible to add a JSON object to the data source and rebind the grid?
var data = [{ "ID": 1, "Text": "Text1" }, { "ID": 2, "Text": "Text2" }];
var mtv = $find("RadGrid1").get_masterTableView();
var items = mtv.get_dataSource(); // this won't work because is null
//var items = mtv.get_dataItems(); // this is obvious way to do it, but I want to insert a json object
var newItems = items.splice(3, 0, data); // insert object
mtv.set_dataSource(items); // (item actually get's inserted into orginal items,and not newItems - bit result is same either way)
mtv.dataBind();
However:
1) The data source is null - I guess upon rendering it gets reset
2) I can add items to the 'dataItems' array, but I guess this has to be formatted as HTML.
Is it possible to add a JSON object to the data source and rebind the grid?