Dynamic titleText in table view (reprise)

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

Hi Don,

Such a call would look like this:

/**
 * @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

Thank you Robert! - Don

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.

Also a form variable could work