How can you affect the background color of a field, based on that field’s value, in a list or table view?
When you name the element your value is shown in, all accessible properties are shown in the methodeditor. One of them is bgcolor.
By creating a method onShow and onRecordSelect of the form that looks like below you can archieve what you want. Another way is creating a calculated field with html in there.
if (value == 1) {
elements.value.bgcolor = 'ffffff';
} else {
elements.value.bgcolor = 'aaaaaa';
}
Marcel.. (first off, thank you for the reply!) I understand how what you suggested would work for detail view. I need to do this in a tabless tabpanel displaying a form in table view. Since, in table view, the ‘text’ property of the form refers to the column header and not the field itself, where would you put the html? And since the data is displaying in a tabless tabpanel on another layout, it’s always visible, thus you can’t use OnShow, OnHide, or OnRecordSelection (the last because the field color needs to show for all displayed records, not just the one selected). What am I missing?
David… I need to change colors for individual field backgrounds, not for the entire row. Still not seeing how to do that.
JerryR:
David… I need to change colors for individual field backgrounds, not for the entire row. Still not seeing how to do that.
Tough to do in list or table view. Why? A named element is not unique in list or table view. A specific row isM-^Wwhich is why you can color certain rows depending on a value.
Here is where you want to use html to display your data set. This technique requires you to use the “getDataSetByQuery()” method, and then loop through the results building an html table. As you loop and build, you can color any particular background cells based on any conditions you want. In addition, you can attach javascript calls to methods in your html allowing your result to be an html table with the exact formatting you want and with links to manipulate the data further (like go to a detail view for the clicked record).
- David