Below I’ll demonstrate how to use the Tadabase JavaScript API to hide/show a component based on if a Table Component has zero records or not.
In this example, we’ll display an HTML component but only when there are Zero records in the Table.
Step 1
Find the component ID for the component you will be hiding/showing and the Table Component.
In my example, that would be component_3 and component_6
Step 2
Add the following code to the JavaScript section of your page. Make sure you replace component_3 and component_6 with your component IDs.
var tableComponentId = 'component_6';
var htmlComponentId = 'component_3';
TB.render(tableComponentId,function(data){
if(data.records.length){
TB.hideComponent(htmlComponentId);
} else {
TB.showComponent(htmlComponentId);
}
});