Change table headers

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

Change table headers

#1

Postby Segi » Wed May 21, 2014 5:49 pm

Is there a way to change the table column heading at run time so that instead of displaying the column name, I can set the display value to something else ?

I have been looking through the server side JavaScript APIs and have not found a way to do so.
0 x

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

#2

Postby Jon » Thu May 22, 2014 7:21 am

You need to set the labelText property of a table column - it's not obvious that this is used for the column header. You can set it to any value you choose e.g.

Code: Select all

tables.T1.COL1.labelText.text = "New header";
0 x

LKirby
Ebase User
Posts: 37
Joined: Wed Mar 13, 2013 11:33 am
Contact:

#3

Postby LKirby » Fri Jun 06, 2014 3:18 pm

Hi,

I've tried this out for a project where there will be 5 columns on a table that are dynamically set. Using JS I can lookup and set the text for these columns fine in a before page script, but as soon as I click on the next / prev page button on the table control, the columns loose their labels and go back to the default values.

I've tried doing it via

Code: Select all

tables.tname.colname.getLabelText().setText("actual_column_label"); 
and

Code: Select all

controls.col_name.getTableColumn().labelText.setText("actual_column_label");
but the columns still loose their labels when going between table pages.

Any ideas on this? I'm using Ebase 4.5.1.
0 x

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

#4

Postby Jon » Fri Jun 06, 2014 3:55 pm

You need to change the header text before you load any data into the table. Alternatively, if you already have data in the table, you will have to loop through all rows in the table and set the header text for each row i.e.

Code: Select all

var rows = tables.CUSTOMER.rows;
while (rows.next())
{
	tables.CUSTOMER.NAME.labelText.text = "Test";
}
0 x

LKirby
Ebase User
Posts: 37
Joined: Wed Mar 13, 2013 11:33 am
Contact:

#5

Postby LKirby » Mon Jun 09, 2014 7:14 am

I did try changing the column names before putting any data into the table and it only set the labels on the first table page, so when clicking on the table page number controls (1, 2, 3, etc) they would loose the labels on the columns.

So I tried setting the column names on each row and it works, thank you :)
0 x


Who is online

Users browsing this forum: No registered users and 14 guests