TSThavasianand Sankaranarayanan Syncfusion Team February 12, 2019 06:41 AM UTC
Greetings from Syncfusion.
Based on your query we suspect that you want to do CRUD operations in Grid. By default, if you are using CRUD operation in Grid then we need to have isPrimaryKey column, which has the unique value. So, we suggest you to set the isPrimaryKey for particular column in Grid. Also if we have blank values in Grid then while editing that row it will shown the proper values in edit form because it is not fetching the proper value when isPrimaryKey column value as null.
Please let us know if you need further assistance on this.
SASahalFebruary 12, 2019 07:56 AM UTC
Usually data stored in the database have an identity column and a primary key. ie on insert the primary key is incremented. If we set that field as the primary key for the grid whenever a new row is added, it will have a null value and hence the editing won't work properly.
If we somehow increment this field and set it on the grid, when we sent the data to the db, the newly incremented values may or may not be present and will lead to an inconsistent edit/insert operation
Could you please provide sample for my scenario
In my opinion the desired behavior of the grid should be that when a primary key is set by the code, the grid should automatically create a hidden primary key and manage the CRUD operation. This is how Microsoft manages in their DataGridView Control.
MSMadhu Sudhanan P Syncfusion Team February 14, 2019 09:31 AM UTC
Thanks for your update.
Query : the desired behavior of the grid should be that when a primary key is set by the code, the grid should automatically create a hidden primary key and manage the CRUD operation
We have analyzed your query and by default, the grid must be configured with a primary key column to perform the CRUD operations.
In your scenario, you have provided the data source as local array and the save operation is performed externally to the server hence the primary key obtained after the ‘Update’ action is not reflected in the grid. To resolve this, we suggest to get the updated data from the database and provide it to the grid once again in the actionComplete event when args.requestType is ‘save’.
Also please provide the below information for us to analyze your query and provide a better solution as soon as possible,
Share the full grid code example?
Share the reason for setting the grid data source with local data?
Share the server side code example?
Share your exact grid requirement for us to create a custom sample?