Showing child column in parent repeater not working

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

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Showing child column in parent repeater not working

#1

Postby Segi » Tue Sep 20, 2016 12:18 am

I'm trying to conditionally show a table column that is a child of a repeater control for one specific parent repeater but its not working.

I have tried making the column in question initially hidden then conditionally showing it or letting the column be visible initially and hiding all other columns but Ebase does not hide or show the column correctly either way.

The repeater is organized this way:

DEPARTMENT NAME
Department child row 1
Department child row 2
Department child row 3
Department child row 4
NEXT DEPARTMENT NAME
Department child row 1
Department child row 2
Department child row 3
Department child row 4

Each child row has a cert hyperlink column. I want to hide this cert column for all departments except for 1 specific department.

The script that is supposed to do this looks like this:

Code: Select all

var allDepartments=tables.DEPARTMENT;
var allRows=tables.LOGS;

rows=allRows.getRows();

while (rows.next()) {                     
     parentRow=allDepartments.findRow(allDepartments.DEPARTMENT,allRows.DEPARTMENT.value);

     if (parentRow != -1) {
          allDepartments.setCurrentRow(parentRow);

          if (allRows.DEPARTMENT.value=="TE") {
               // Show the column
               allRows.Cert.columnControl.setHidden(false);
               controls.CERTCOLUMN.show();
          }
     }
}
The line if (allRows.DEPARTMENT.value=="TE") { is supposed to show the column but it doesn't. If I use allRows.Cert.columnControl.all.setHidden(false); or controls.CERTCOLUMN.all.show(); the column gets shown for all departments which is wrong. Is this a bug ?

Update: I did something that's one step closer to what I want to do but not quite there. I made the cert column visible then changed the if loop

Code: Select all

               if (allDepartments.CALIBRATIONLOGPREFIX.value != "TE") {
                     allRows.Cert.columnControl.setHidden(true);
                     controls.CERTCOLUMN.hide();
               }
with this method, the columns are still there for all departments but don't display a value for departments that are not TE
0 x

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

#2

Postby Jon » Tue Sep 20, 2016 7:29 am

Sorry but I can't quite understand this. Can you show the control structure and how these relate to your two tables.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#3

Postby Segi » Tue Sep 20, 2016 8:43 am

Ok so parent control is a list of departments. Each department has a child repeater table with data rows that belong to that department . This child table has various columns but one in particular is called cert. Using the logic below, I want to entirely hide the cert columns for all departments except 1 specific one. At the moment, the code in my update below causes the cert column data to be empty for all rows except the department that i do want to show it on but I'd like to hide the cert column entirely
0 x

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

#4

Postby Jon » Tue Sep 20, 2016 4:19 pm

So I think you have a Repeater Control (departments) with a nested Table Control (logs) inside this.

If you issue hide against a Table Column Control (which can only exist inside a Table Control) the column will still be shown but the data will be blanked out. If you want to remove a column completely from a Table Control, you must additionally specify all as you have discovered.

However, if you use a Repeater Control instead of a Table Control for logs, then you will have Field Controls instead of Table Column Controls representing each column. If you issue hide against a Field Control, it will disappear.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#5

Postby Segi » Tue Sep 20, 2016 4:21 pm

Jon,

if I do allRows.Cert.columnControl.all.setHidden(true); the Cert column gets hidden for all departments which is not what I want to do. Please explain what you mean ?

Again, the structure is organized this way:

Code: Select all

Repeater (Departments)
    Table Control (All rows for the current dept)
Are you suggesting that I change the Table control somehow to a field control ? I need to have the data displayed in a table format. At the moment the column data gets blanked out but not hidden for the departments that I want to have the Cert column hidden on.
0 x

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

#6

Postby Jon » Tue Sep 20, 2016 5:06 pm

It depends what you want to do - you can't totally remove a column in a table because it would destroy the alignment of the other rows, all you can do is blank out the data under the column header. If you don't want to display it, that's what you should do.

You can choose to display it as a repeater if you want to, then you have more control. But you have to look after your own alignment and display of the table rows.
0 x


Who is online

Users browsing this forum: No registered users and 2 guests