The editable table list is a form component designed to support bulk manipulation of data and is optimized to be operated only using the keyboard.
Regular table lists are static tables that display information in rows and columns. This information is read-only, meaning it cannot be edited directly within the table itself. To edit multiple rows, users need to navigate back and forth between the table list and a dedicated support form. On the other hand, editable table lists allows users to modify the data directly within the table itself, which is particularly useful in scenarios where users need to manipulate multiple rows.
One of the key features of editable table lists is their ability to maintain in-memory changes to multiple rows simultaneously, saving them at once during the save operation of their parent form. This creates the possibility of enforcing rules that affect multiple rows. More on this is discussed on the save operation section.
Editable table lists can offer many benefits over regular table lists, but they also come with some disadvantages that need to be considered when using them. Carefully balance the trade-offs between usability and performance when evaluating using component.
This section provides a detailed explanation on the editable table list's architecture and design and how its different components work together.
As the users interact with editable table lists, each row goes through a subset of the following states:
To make users aware of the state of each row in an editable table list, visual cues are used that clearly indicate the current state of each row. A summary of the visual cues used to display the state of each row is shown in Table 1.
Row state | Row color | Row icon |
---|---|---|
Unmodified | $gray | none |
Modified | $info | |
New | $success | |
Deleted | $gray-dark | |
Error | $danger |
Table 1. Summary of the visual cues used to display the state of each row.
Row insertion in the context of editable table lists is supported by an auxiliary row that is displayed at all times at the bottom of the table, as shown in Figure 1.
Figure 1. Auxiliary row to support insertion of new rows.
It's worth noting that there is no explicit insert button. To ensure the auxiliary row is displayed at all times, a new auxiliary row is automatically inserted at the bottom of the table as soon as users begin to alter it, as shown in Figure 2. Similarly, the editable table list automatically removes any new rows that no longer differ from the auxiliary row. Combined, these two mechanisms ensure that exactly one empty auxiliary row is displayed at the bottom of the table.
Figure 2. Automatic management of empty rows.
In an editable table list, the action that is offered to delete a row depends on its initial state:
Figure 3. Undo button in a row that is marked to be deleted.
As discussed, editable table lists keep in-memory changes to multiple rows simultaneously and save them at once during the save operation of their parent form. During this operation, the parent form begins by attempting to save all of its editable table list components, and only then saving the changes of itself, as suggested by Spec. 1.
/**
* Form save.
* ---------
* Saves all child editable table lists and then saves itself.
*/
saveForm() {
editableTableList1.save()
editableTableList2.save()
/** ... */
self.save()
}
Spec. 1. Pseudocode of the save operation of a form with editable table lists.
Note how, by saving the main record after the child editable table lists, it becomes possible to specify business rules over their rows (e.g., the sum of a given column of an editable table list must be equal to 100). If the conditions are not met, the changes are reverted.
Since the size of the data to be saved is uncertain and potentially large, the save operation of editable table lists takes into consideration the following concerns:
The save operation of editable table lists takes advantage of the following mechanisms to minimize network usage and server load:
As discussed, the save operation of editable table lists is a process controlled by the table's parent form. Because of this, the users do not need to click additional buttons to save the table - it happens automatically during the save operation of the table's parent form. If any errors occur during this process, the appropriate rows (and fields, when applicable) are highlighted with error indicators, and popovers are displayed so users can check the error messages, as shown in Figure 4.
Figure 4. Error highlighting with associated error message.
The complete changelog of all notable changes made to the Editable Table List component.