The table component in DataSiv enables you to display and edit data (e.g. from a SQL database, a Google Sheets UI, Zendesk, or Salesforce) from a table view.

3276

You first start off by connecting your data to the data property.

👍

Use transforms to preprocess data before display it in a table

Transforms enable you to take the output of a data query (e.g. an array of items), and preprocess it before displaying it in a table. If you want to only display certain columns, or have control over what data is displayed in a table, use a transform! Overview provides an overview of how transforms work.

Changing column colors quickstart

To change the color of a column, first add the column name that you want to change the color of on the right hand menu.

870

The comparison applies to the current column property. For example, numerical and string values can use the greater Than or Equal To conditions. Click the + background button, and you should be able to change colors under various conditions.

🚧

To reference other columns in the same table, use the {{dynamic}} keyword

E.g., {{dynamic.Status}}

1517

You should now be good to go! The Health column should now have varying colors of green, red, orange etc.

Editing rows quickstart

If you need to enable users to modify rows, one row at a time, the fastest way to do it is as follows.

  1. Set the Selected Row property to single. This will enable users to select rows from the table, one at a time. You'll be able to reference all the columns from the table via the Selected Row property, which stores an array of selected rows. In the instance when Selected Row is set to single, the Selected Row property will always be an array with only one value--the current selected row.
2764

Drag a data input component into the grid, (e.g. an input), and set the default value property to be the value of the Selected Row in the table. For a text input, this is Default Text, while for a select input, this is Default Selected Item.

3250

For example, if we want to edit the name corresponding to an artist, set the Default Text property to {{data.table0.selectedRow.0.Name}}.

📘

What are {{}} good for?

All component properties are stored in a global key value store that other components in the app are able to access. You are able to reference other components using javascript dictionary terminology.

Based on Django's templated {{}} syntax, the special {{}} expression allows you to substitute in values from one set of objects in your application to another. For example, for the Default Text property, we reference the selectedRow.0.First Name property of the table with identifier table0. As all frontend components are stored under the global data key, to reference this component, we would write {{data.table0.selectedRow.0.Name}}.

Then, make a query that references the selected row and the user input to write back to the database. We'll trigger this query from a button!

2758

Now, you're able to reference both the selected row column (e.g. the CustomerId) and the new first name (from the input field) inside a query.

3342

Last, drag a button and connect it to your query (e.g. sqlApi0) by updating the code property. For example, if your table loaded data from query sqlApi1 and the save query was sqlApi0, you would want to select the queries.sql0 and queries.sql1 queries.

That's it! Now, when you click on a new row in the table and type in a name, you're able to save the first name to the corresponding CustomerId by clicking Save Changes.

Hiding columns

To hide columns but still access them in the selectedRow property, click Edit columnProperties, type in the column name you'd like to hide, and set Component to hidden.

Making multiple rows editable at once (bulk updates)

To make multiple rows editable (advanced), click Edit columnProperties and type in the column names you'd like to enable edit access to. Set Editable to true.

2554

Whenever you make changes, they will be stored in a modifiedRows table property, and a Save button will appear on the bottom right, that will trigger the saveCode code. Reference the modifiedRows property when creating a bulk query.

In the saveCode property, you're able to trigger the bulk query to run with the modified rows. See Triggering Queries & Analytics

Server Side Pagination

Oftentimes, you'd still like display your data, but you need to have server side pagination. To enable server side pagination, please click the mode property and select serverSidePagination.

2576

You need to specify the total number of rows in the table. For example, you're able to do this by the following SQL query (which is used in the count property above)

1580

Finally, update the query used to load in the data with the pageSize and paginationOffset fields from the table, to have your paginated query.

1590

If you need to have server side filters and sort, the sorter and filters property of the table has the current selected filters and column which is being sorted, which you're able to plug into your SQL query or a transform.