PDA

View Full Version : How to change the background color in a dependent field?


Test6405
11-02-2009, 05:06 PM
Hi all,

in my table I need to make so that nominal field changes its background cold color to a hot color when value of any other field was changed. How it may be maked simpler?

NB. I create the table thus:
var table = new OverwriteTable(null, null, "MERGE");

Mone
11-02-2009, 05:55 PM
Hi,

you can do that with a little trick
imagine that you have 3 fields A B and C and that you want to highlight A when B or C changes:
table.onChangingValues = function(itemPos, visualUpdateInfo, itemName) {
if (visualUpdateInfo != null) {
if (visualUpdateInfo.getFormattedValue("B") || visualUpdateInfo.getFormattedValue("C")) {
visualUpdateInfo.setFormattedValue("A",visualUpdateInfo.getServerValue("A"));
visualUpdateInfo.setAttribute("A","red","green","backgroundColor");
}
}
};

that's just a little PoC, you should customize the code to fit yours.
HTH