Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
Multiple row addition at the client side
posted

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?

 

 

Parents
No Data
Reply
  • 33839
    Suggested Answer
    posted

    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 

Children