In an inline editable grid, track the employees that are added for further processing in the next process steps.
Also track the ids of items that are deleted for use in the Delete from Data Store Entities smart service after the user submits the form.
This design pattern is not recommended for offline interfaces because reflecting immediate changes in an interface based on user interaction requires a connection to the server.
This scenario demonstrates:
How to store data into multiple variables when the user interacts with the components in a grid layout.
Test it out
Remove a row from the pre-loaded data set by clicking the "X" link. Notice that the item id is added to the array of deleted item ids.
Add a row, enter values into the blank fields. Notice that the new employee is added to the array of added employees in the New Employees field.
Notable implementation details
New employee values are seen immediately after updating in the New Employees field. This field is simply showing any values in local!employees without an value for id.
If you intend to immediately write the new and edited items using the Write to Data Store Entities smart service, you don't need to capture the array of added items separately from your items array. This is because the Write to Data Store Entity smart service can do updates and inserts at the same time. See also: Write to Data Store Entity Smart Service
The array of deleted item ids may contain null values corresponding to newly added items. You don't have to remove the nulls if you are planning on passing the ids to the Delete from Data Store Entities smart service. This is because the smart service ignores the null values. See also: Delete from Data Store Entities Smart Service