Layout nested tables

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

aschultz
Ebase User
Posts: 11
Joined: Sun Oct 11, 2015 12:56 pm

Layout nested tables

#1

Postby aschultz » Wed Aug 03, 2016 8:14 am

Hi,

I have a couple of nested tables within a repeater. When a nested table has no rows it should say something like 'no data available'. These tables are then used in a pdf.

The control style option 'display no. rows information text' comes close to what i want. But i don't want to show the number of rows. And the columns shouldn't be visible either. Only the table header.

I've tried to replace the tables with repeaters but i can't get the layout right. In the form it displays correctly, but when it is transformed in a pdf it messes up the tables.

Is there a solution where i can get it to work with tables?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Aug 03, 2016 9:48 am

I think the simplest approach is to loop through the rows in the outer parent table and for each row check for the number of visible rows within the nested table, and then just hide/show controls as you need to e.g. you could have a hidden text control next to the table with "No data available" and only show this when there are no visible rows. Something like this..

Code: Select all

var parentRows = tables.parentTable.rows;
while (parentRows.next())
{
  var tableEmpty = tables.childTable.control.numVisibleRows == 0;
  controls.noDataControl.setHidden(!tableEmpty );
  tables.childTable.control.setHidden(tableEmpty );
}    
I haven't tried this so there may well be errors in the code, but it should work in principle.
0 x

aschultz
Ebase User
Posts: 11
Joined: Sun Oct 11, 2015 12:56 pm

#3

Postby aschultz » Wed Aug 03, 2016 10:26 am

Hi Jon,

Thanks for your quick response!

The getControl function of the table object is described as "Returns the first Table Control or Repeater Control on the current page that displays this table."
If i understand correctlty this means that it isn't possible to get specific table controls.

The numVisibleRows attribute is only accesible if i get the control through controls.controlname.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Wed Aug 03, 2016 11:25 am

It's fine to use controls.controlname to address the child table control.
0 x


Who is online

Users browsing this forum: No registered users and 20 guests