Advanced options to embed Cloud DB UI
With this guide you will be able to customize the user experience while embedding Cloud DB UI, Check the demo link here.
Iframe URL Query string Parameters
Parameter | Values | Description |
---|---|---|
embed | 1 or 0 | Show / hide the topbar |
controls | 1 or 0 | Show / hide the toolbar |
checkboxes | 1 or 0 | Display a checkbox before each row that trigger an event when selected |
actions | 1 or 0 | Display actions configured on the view |
bottombar | 1 or 0 | Show / Hide the footer bar |
columns-controls | 1 or 0 | Show / hide column actions |
control-add |
1 or 0 | Show / hide add buttons |
control-edit |
1 or 0 | Show / hide edit buttons |
control-delete-row |
1 or 0 | Show / hide delete row button |
control-expand |
1 or 0 | Show / hide expand buttons |
control-filters |
1 or 0 | Show / hide filter options |
control-sort |
1 or 0 | Show / hide sort options |
control-groups |
1 or 0 | Show / hide group options |
control-rows |
1 or 0 | Show / hide row height switch |
control-actions |
1 or 0 | Show / hide action options |
control-visibility |
1 or 0 | Show / hide visibility options |
control-import |
1 or 0 | Show / hide import button |
control-export |
1 or 0 | Show / hide export button |
control-delete-table |
1 or 0 | Show / hide delete table option |
control-search |
1 or 0 | Show / hide searchbar |
control-views |
1 or 0 | Show / hide view options |
Example of url with no topbar, no toolbar, checkboxes and no control on the columns :
- YOUR_VIEW_FULLURL?embed=1&controls=0&checkboxes=1&columns-controls=0
- YOUR_VIEW_FULLURL can be either a temporary generated URL as described below or obtained from the share panel > views:
Communication between your page and the Cloud DB UI embedded iframe
The communication is done through message post to and from the iframe. In this example the iframe id is cloudDBIframe.
The events coming from the iframe are described in the event.data.action. Possible values are :
-
getFilters: returns an array of the the current filters applied to the view. You can modify them and apply it to the iframe using updateFilters.
-
cellClicked: returns in event.data.infos essential information about the cell clicked. The row object, all column infos, the subtype of the column, the table and the column value of the row. If a tag or an image is selected you will get additional details.
-
checkedRowsUpdate: this event requires checkboxes enabled on your query string parameters. It returns an array of the checked rows and the table.
-
actionClicked: you can create event actions in Cloud DB UI. Those actions will trigger the action clicked event with the row object, the table and action names.
The actions you can post to the iframe are the following :
-
getFilters: Returns an array of the current filters applied to the view. Return values can be retrieved in the getFilters event.
-
updateFilters: applies the array of filters to the view and reload automatically.
-
updateSearch: Changes the value of the search input of the Cloud DB UI (visible or not). It allows you to search values inside all displayed rows and columns.
-
reloadData: use it to reload the view content to watch new or updated rows from your table.
-
exportCSV: to trigger a CSV export with the filters applied.
Example :
See the Pen Cloud DB UI by David (@DavidAppdrag) on CodePen.
Generate Tmp Access to Cloud DB UI Shared Views
Generate a TMP Access to view with custom filters
Imagine you want to create a secured dashboard that integrates Cloud DB UI for companies. Each company should see only its own data. To do so you can create manually a view for each and apply a filter with the company ID and use those generated links. It works for 2 or 3 companies, but if you have dozens, hundreds, thousands of companies it’s not scalable.
To manage this use case you can create temporary Cloud DB UI URLs. A sample is available on Cloud Backend API > New Function > Node.js > Database.
Once created you just have to specify the viewid as the post parameter but a final step is required if you want to specify the company. You can uncomment the filter line that add one filter on the company column to the value 42 (you can add multiple filters if needed).
To automate this you can add a token parameter and use it to fetch the user company from the database and use it dynamically to generate the appropriate link.
See the Pen CloudDB UI 2 by David (@DavidAppdrag) on CodePen.
Links last 8 hours and expires automatically. A link generated during this period with the exact same parameters will return the same URL.