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.
Change table headers
Moderators: Jon, Steve, Ian, Dave
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
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
-
- Ebase User
- Posts: 37
- Joined: Wed Mar 13, 2013 11:33 am
- Contact:
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
and
but the columns still loose their labels when going between table pages.
Any ideas on this? I'm using Ebase 4.5.1.
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");
Code: Select all
controls.col_name.getTableColumn().labelText.setText("actual_column_label");
Any ideas on this? I'm using Ebase 4.5.1.
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 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
-
- Ebase User
- Posts: 37
- Joined: Wed Mar 13, 2013 11:33 am
- Contact:
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
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 6 guests