How to Hide Component Based on “No Records” in Table
Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add this functionality is through the plugin installation wizard. Learn more about plugins here.
This snippet will teach you how to hide a component when a table doesn’t have any records showing.
The solution provided is through custom JS code:
Step 1
Find the Component ID of the table you'd like to hide when it doesn't contain any records.
Step 2
Add the following JavaScript to the JavaScript tab on the parent page (the page that contains the form), not the details page. Replace component_xx
with your component number.
TB.render(‘component_XX’, function(data) {
if (data.records === undefined || data.records.length === 0) {
data.ele.css(‘display’,‘none’)
}
});
Please note that this does not work if the table is filtered.
Original Community Post:
https://community.tadabase.io/t/hide-component-based-on-no-records-in-table/2120
We'd love to hear your feedback.