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
170
Adding multiple new rows without "Add new row" button
posted

Hi,

Please help!

I am trying to add a new row to igGrid table. I have a button "Add" when I click on it I want to add a new blank row where I can enter values.  

When I am trying to do something like this:

jQuery("#securityOnlyModel").igGridUpdating("option", "enableAddRow", true);

jQuery("#securityonlyModel").igGridUpdating("startAddRowEdit");

It is adding a new row with "Add new row" button which I don't want. I want to add a row directly into edit mode. 

Also I want to add multiple rows at the same time. So if I click on "Add" multiple times I want to add multiple rows and then I can enter values at the same time. 

One more thing, right now all the rows are read only so that I can not change their values but in the case of new row I should be able to enter values in it. 

Thanks,

Mohan

Parents
  • 1235
    posted

    Hello Mohan,

    After startAddRowEdit, the endEdit function can be called in order to save the new row to the igGrid as a record. Afterwards start edit mode for the newly added row, by calling the method startEdit.

    What I would suggest for the readOnly rows - when the grid is rendered add, for example, a "readOnly" class to every row in the grid. On editRowStarting event check if the row for editing has this class and if it does cancel the event.

    Only one row at a time can be in edit mode. Multiple rows cannot be edited at the same time.

    I have attached a sample in reference to your issue. I have customized it to make a newly added row readOnly after all of its fields are filled. Please test it and let me know how it went.

    Regards,
    Ivaylo Hubenov
    Entry-level developer

    Sample.zip
Reply Children