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 Reply
  • 325
    posted in reply to [Infragistics] David Young

    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:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    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] =

     

     

    ''

    ;

    addVals[1] =

     

     

    "2620"

    ;

    addVals[2] =

     

     

    "GL2"

    ;

    addVals[3] =

     

     

    "Cost Center 3"

    ;

    addVals[4] = 100;

     

     

     

    var newValues = new

    Array(addVals[0], addVals[1], addVals[2], addVals[3], addVals[4]);

    ds[ds.length] = newRow;

     

     

     

    var addAction = new $IG.GridAction("AddRow", "EditingCore"

    , grid.get_behaviors().get_editingCore(), newValues);

    grid._actionList.add_transaction(addAction,

     

     

    true

    );

    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,

    Divya

     

Children