We have a webdatagrid.We are trying to add multiple rows to the grid on the client side by means of the client side method :
function
callCostCenterSuccess(res) {
var sArray = res.split("||")
var grid = $find('BaseCostCenterHGrid');
for (var i = 0; i < sArray.length; i++) {
var ccAttributes = sArray[i].split("~");
if (ccAttributes.length > 1) {
var newValues = new Array(ccAttributes[0], ccAttributes[1], ccAttributes[2]);
grid.get_gridView().get_rows().add(newValues);
}
CloseDialog(dialogCostCenter);
We are calling the client side add method in a for loop.
What we see is that the entire loop gets executed but only the last row gets added to the grid.
Is there any way we can get over this problem?
Hi divyaramesh,
When you call grid.get_rows().add(), the grid immediately causes a postback (ajax or full page depending upon enable ajax) the same as if the row had been added from the row adding behavior. What you're probably looking for is batch updating. This will be available in 11.2. Another option would be to turn on client rendering. You could add your new row to the client data source of the grid and rebind. Then you will see the row. You would simply have to log the action and do the add on the next postback. Or use your own ajax call and do the insert from JavaScript.
regards,David Young
Hello David,
We are relying heavily on these controls.
Can you please provide me examples for your suggestion.
This is a showstopper for us.
If you dont provide us a solution, we ll have to remove these controls all together as we are in heavy need of this functionality.
best,
divya
Hi divya,
Sorry about that. This is pretty easy to do and I just tested it myself. Be warned that technically it is using some private methods, so wouldn't officially be supported.
function addRows()
{
var grid = $find("WebDataGrid1");
var ds = grid.get_dataSource();
for(var x = 0; x < 3; ++x)
var newRow = new Object();
newRow.Id = 100 + x;
var addVals = [];
addVals[0] = 100 + x;
ds[ds.length] = newRow;
var addAction = new $IG.AddedRowAction("AddRow", "EditingCore", grid.get_behaviors().get_editingCore(), addVals);
grid._actionList.add_transaction(addAction, true);
grid.applyClientBinding();
This should do the trick. It will add them temporarily on the client and log the actions to be added next trip to the server.
Dave
David,
Thanks for the solution.
I tried doing this.But i feel some property needs to be added to the grid cos all the while my script is gving me an error.
I am attaching my sample.Plase tell me what properties needs to be set on my grid so that the script does not throw an error.
the grid.get_behaviors().get_editingCore() is throwing an object expected error.
Please look into my sample and tell me what additional properties needs to be set on my grid.
Divya
Hi Divya,
Looks like AddedRowAction was something added in 11.2. You need to make it as a new $IG.GridAction instead.
-Dave
Dave:
I made the suggested change.Now its not throwing any error.
I can see rows getting added as well but with no values.Apparently the rows are rendered as empty with no values in the columns.
My jscript function:
addRows() {
);
ds = grid.get_dataSource();
x = 0; x < 3; ++x) {
Object();
addVals = [];
addVals[0] =
;
addVals[1] =
addVals[2] =
addVals[3] =
addVals[4] = 100;
Array(addVals[0], addVals[1], addVals[2], addVals[3], addVals[4]);
, grid.get_behaviors().get_editingCore(), newValues);
grid._actionList.add_transaction(addAction,
All other code remains same as in the sample that i attached previously.
I am attching a screenshot after i add the rows.The rows are coming empty.
We are running 11.1 version of infragistics.
Can you look into this and let me know.
-best,
The best approach at this time is to wait for 11.2. There currently is no workaround for this issue in the WebHierarchicalDataGrid because the settings to enable this won't be available until 11.2.
As for the release of 11.2, we currently do not have a date I can provide. However, if you check the Infragistics Product Lifecycle webpage (http://ko.infragistics.com/support/product-lifecycle.aspx) you can see that historically the x.2/x.3 release for a year has come out around October. While I recommend checking for the release around that time, please note that it may be later in the year.
That is sad.
Is ther a work around for the time being to do batch updating on client for whdg?
And when is 11.2 releasing?
Hello Divya,
Batch updating in the WebHierarchicalDataGrid will be available in our 11.2 release. At this time, there is no way to implement this behavior in the WebHierarchicalDataGrid. You will be able to use this behavior once the 11.2 version is released.
Please let me know if I can be of any further assistance with this matter.
Hey please tell me how we can do the same thing for hierarchical grid?
Please provide us a way as our development hass come to a standstill because of this