Page 1 of 1

Dynamic titleText in table view (reprise)

PostPosted: Tue Jul 10, 2012 7:36 am
by djlapin
Okay, I've read through what seem to be the recent discussions on this topic. But, being a neophyte, I still don't know how to work around the limitation of not being able to set titles at runtime.

My table view is in a tab panel and displays a roster (Mon-Fri x 4 weeks, for 20 columns, see attached pic). So the column headers need to show the correct dates when the user changes the starting date of the roster.

Is this somehow done by changing the titleText with a solution model call, then refreshing? What does the call look like.

Thank you,
Don

Re: Dynamic titleText in table view (reprise)

PostPosted: Tue Jul 10, 2012 1:21 pm
by ROCLASI
Hi Don,

Such a call would look like this:
Code: Select all
/**
* @param {String} formName
* @param {String} elementName
* @param {String} titleText
*/
function doSetColumnTitle(formName, elementName, titleText) {
    var _oForm = solutionModel.getForm(formName),
        _oField;
    if (!_oForm) {
        application.output("Can't get form object with name '" + formName + "'", LOGGINGLEVEL.ERROR);
        return;
    }
    _oField = _oForm.getField(elementName);
    if (!_oField) {
        application.output("Can't get field object with name '" + elementName + "'", LOGGINGLEVEL.ERROR);
        return;
    }
    _oField.titleText = titleText;
    forms[formName].controller.recreateUI();
}


Just pass the correct formname and elementname (element needs to have a name set) and the titletext.

Hope this helps

Re: Dynamic titleText in table view (reprise)

PostPosted: Tue Jul 10, 2012 8:38 pm
by djlapin
Thank you Robert! - Don

Re: Dynamic titleText in table view (reprise)

PostPosted: Fri May 09, 2014 6:16 pm
by amcgilly
Here's another approach which worked for me, but may not be applicable in all situations: if you can get a calc to return the label you want, then put that calc in the titleText property in the form editor, and it will refresh in the table header dynamically.

Re: Dynamic titleText in table view (reprise)

PostPosted: Sun May 11, 2014 11:18 am
by jasantana
Also a form variable could work