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
Hello Mohan,
There is no option in the igGrid that renders new rows on the top of the table.
To call editRowEnding and editRowEnded events when endEdit is called there has to be a second parameter to the function, which is true. The endEdit method accepts two parameters - the first one specifies if the edit process should accept the current changes or not and the second, whether or not updating events should be raised.
It is the igGrid's regular behavior when the showDoneCancelButtons option is set to false there to be no done/cancel buttons in the grid.
The method you are using to get rows' values is good.
By setting a column readOnly from the columnSettings those cells will not be editable in the new rows, therefore you cannot enter values in them.
Please feel free to contact me if you have further questions.
Regards,Ivaylo HubenovEntry-level developer
Hi Ivaylo,
Sorry about that. Please find the attached .zip archive.
I cannot open the file you have attached. Can you please attach it once again but as a .zip archive?
Please have a look at my code. First thing I want is to add new rows at the top of my table. Right now when I add a new row it is getting added at the bottom of the table. Also when I click on Add I am adding a new row with some defaults values but then again I click on Add, the last added row is getting added at the bottom but without default values. I don't know why "editRowEnding" or "editRowEnded" are not getting called at all. It is also possible that I don't enter the primary key field. "Done/Cancel" button is false in all the cases.
I want to add multiple rows and then when I click on save I am calling createStandardModelDTO. Please have a look at it and let me know if this is the right way to collect values from newly added row and old rows.
When I edit the row I want to push some properties to the datasource array which I can use in my rowtemplate.
Also please have a look at how I am setting read only properties in Updating feature.
The input, inside of a column's cell can be made readOnly. What I suggest is to check on editRowStarted if a row is newly added or not and set the input readOnly or editable. You can access a cell of a certain column by specifying the "aria-describedby" attribute in the query. This attribute's value is formed by the grid's id, followed by an underscore and column key.
The delete button in your code is in a column template, so it should be visible on the manually added rows.
I have modified my sample to make only certain columns not editable. For newly added rows those columns are readOnly after they have been filled.
Please test my sample and let me know how it went.