Please consider the following scenario:
- IgniteUI 16.1 igGrid with igGridUpdating and RESTDataSource
- The user creates a new entry through a modal dialog.
- Submit request begins with form data
- The server processes the creation request and returns an object filled with the correct identifier
- In the client-side success handler, the newly added row in the grid row must be found and updated with the correct identifier returned from the server.
- The identity column serves as the primary key of the grid and is hidden
What happens when adding a new line?
We look at infragistics.lob-16.1.js
At _dialogOpening()line 68167, _originalValuesare calculated through $.extend(this._originalValues, values, this._originalValues), where, values = _getDefaultValues()or in other words values.id = this._pkVal. And _pkVal- this is a counter that increases every time a new line appears.
Keeping this in mind, it is later called _endEditDialog()where newValues, representing the user input, is combined with the default values for the input form:, newValues = this._getNewValuesForRow(colElements)which are followed newValues = $.extend({}, prevValues, newValues)and prevValuesare the same _originalValuesfrom above.
Then it is called _addRow(), which triggers its launch grid.dataSource.addRow()and a transaction is created.
My point here is that the update function automatically generates an identifier for a new line and ID = CurrentRowsCount + 1.
, 8 , ID = 9. , ID = 9, igGridUpdating updateRow(rowId, values) , . , , .
?