Mashup Builder > Widgets > Standard Widgets > Grid Widget > Adding and Deleting Rows on the Grid
Adding and Deleting Rows on the Grid
You can add or delete rows on the grid run time using the widget RowAddButton and RowDeleteButton properties. Data changes to the grid are stored in the EditedTable and DeleteTable widget properties. Grid edits are stored on the client side. To update the data on the server, bind these infotables to custom data services.
Adding Rows to the Grid
1. In Mashup Builder, select the Grid widget.
2. On the Properties panel, set the RowAddButton property to True.
3. Click Save, then View Mashup.
To add a new row at run time, click Add, and then use the form to set the cell values. The new data is saved to the EditedData infotable property. You can use this property to add the new data rows to the server using a custom data service.
* 
To verify that the data is valid, configure a validation for each column.
Deleting Rows from the Grid
You can select and delete rows when the widget RowSelection property is set to Single or Multiple. To delete rows, perform the following steps:
1. In Mashup Builder, select the Grid widget.
2. On the Properties panel, set the RowDeleteButton property to True.
3. Click Save, then View Mashup.
At run time, select the rows that you want to delete, then click Delete. The deleted rows are added to the DeletedRows infotable. To delete these rows from the grid data source, bind the infotable to a custom data service.
Showing a Confirmation Message when Deleting Rows
You can use widget events and services to bind the delete action to a confirmation dialog box in ThingWorx 9.3.1 and later. This enables you to display a confirmation message when one or more data rows are deleted. To add and configure a confirmation message, perform the following steps:
1. In Mashup Builder, create a Confirmation on the Functions panel, and then configure the function as follows:
Define a title and a message for the confirmation dialog box.
Define a label for the action button.
For more information about Confirmation functions, see Confirmation.
2. Bind the DeleteRowClicked event on the Properties panel of the grid widget to the OpenConfirmation service of the Confirmation function on the Functions panel.
3. Bind the ActionClick event of the function to the ConfirmDelete service of the grid.
4. Click Save, then view the mashup.
When you select and delete one or more rows on the grid, a confirmation message is displayed.
When you click Delete, the ConfirmDelete service of the grid widget is executed and the rows are removed from the grid.
* 
To permanently delete data from the grid, you must use a data service that deletes data on the data service level.
Was this helpful?