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
30
Iggrid add new row multiple error
posted

Hi

I am trying to add multiple new row as following but it giving me following error:

0x800a139e - JavaScript runtime error

var rowObj = { "EmployeeID": $("#grid").igGrid("rows").length + 1,

"FirstName": $("#firstName").val(),

"LastName": $("#lastName").val(), "Title": $("#title").val(), "BirthDate": $("#birthDate").val(), "PostalCode": $("#postCode").val(), "Country": $("#country").val() };


$("#grid").igGridUpdating("addRow", rowObj);

Please help in this.

Regards,

Bhumika

  • 17590
    Offline posted

    Hello Bhumika,

    I prepared a small sample for you demonstrating how row can be added programmatically. I am creating the row object and afterwards I am adding it to the igGrid using addRow method. For example:

    $("#addRowBtn").click(function(){
       var tmpRowsCount = $("#grid").igGrid("rows").length + 1,
              newRowObj = {"ProductID": tmpRowsCount, "Name": "Name " + tmpRowsCount, "ProductNumber": tmpRowsCount, "Col1": "Col1"};


       $("#grid").igGridUpdating("addRow", newRowObj );
      });

    I am attaching this sample for your reference. Please test it on your side and let me know what is the result.
    If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it in order to reproduce the issue and send it back to me.

    Please do not hesitate to contact me if you need any further assistance with this matter.

    igGridAddRowProgramatically.zip