Through searching the forum, I have pieced together a method for creating dynamic labels using session variables in a grid.
Please note, the following scripts and suggestions are cribbed from various posts and are not my own. However, it took me several searches and some trial and error to piece it all together. The majority of the credit goes to Bob Moore for his approach using DIVs in the label property.
These scripts worked for me in A5 V11 on 5/9/2013. Beyond that, you are on your own.
Step 1:
Create a div in the label property of the column you want to dynamically change.
<div id="label_1"></div>
Step 2:
The following JavaScript will work in a button, in the ongridrender event or wherever else you can use javascript on the grid. The ongridrender event is good for dynamically setting the label as the grid loads.
To set it manually:
$('label_1').innerHTML='My New Label';
Set it with a session variable:
var labeltest = {Grid.Object}.getSessionVariable('MYSESSIONVARIABLE');
$('label_1').innerHTML=labeltest;
Notes:
The session variable name must be in CAPS. Also, do NOT use session.mysessionvariable.
The session variable must be previously defined or it will say 'undefined'.
Step 3:
If you are using session variables, be sure to publish the session variables in the grid. (see "published session variables" in grid properties)
You could also pull the labels from your database and then set them, but I haven't worked that part out yet ....
Please note, the following scripts and suggestions are cribbed from various posts and are not my own. However, it took me several searches and some trial and error to piece it all together. The majority of the credit goes to Bob Moore for his approach using DIVs in the label property.
These scripts worked for me in A5 V11 on 5/9/2013. Beyond that, you are on your own.
Step 1:
Create a div in the label property of the column you want to dynamically change.
<div id="label_1"></div>
Step 2:
The following JavaScript will work in a button, in the ongridrender event or wherever else you can use javascript on the grid. The ongridrender event is good for dynamically setting the label as the grid loads.
To set it manually:
$('label_1').innerHTML='My New Label';
Set it with a session variable:
var labeltest = {Grid.Object}.getSessionVariable('MYSESSIONVARIABLE');
$('label_1').innerHTML=labeltest;
Notes:
The session variable name must be in CAPS. Also, do NOT use session.mysessionvariable.
The session variable must be previously defined or it will say 'undefined'.
Step 3:
If you are using session variables, be sure to publish the session variables in the grid. (see "published session variables" in grid properties)
You could also pull the labels from your database and then set them, but I haven't worked that part out yet ....