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
You are simply not giving the grid any data on the client to bind to. That is what this code is for.
var newRow = new Object();
newRow.Id = 100 + x;
ds[ds.length] = newRow;
That is what will be shown when you call applyClientBinding. So simply set up the object with the appropriate properties. It is doing it in two places- one to have the grid show it and the other to have the grid perform the database insert at the postback.
-Dave
Hi David,
I am getting couple of issues after i enabled client rendering on the grid.
I have created a separate post for this @http://blogs.infragistics.com/forums/t/59438.aspx
Could you please look into this.
Best,
Divya
Dave,
We have to add the rows to grid on client side for a webhierarchicalgrid also.
But i dont see an enableclientrendering property there.So what is the equivalent of enableclientrendering for a webhieararchicalgrid.
-best,
Further development is halted because of this.
Please get back as soon as possible.
-regards,
EnableClientRendering is not supported in the WebHierarchicalDataGrid.
Please provide us a way as our development hass come to a standstill because of this
Can we get any help here?
So is there a way to get around this.
We cant get away with the webhierarchicalgrid as we need the grouping feature.
But at the same time we need to do client side multiple row addition as well.
I was trying to do it the way you advised me.
But for that to be done we need to have EnableClientRendering = true.
Please tell me how we can go about this.