The sample page you are using as a base point sets the cell highlighting (i.e. "hot") color for all changed fields based on the change of the "last_price" field value. This necessarily involves a two-phase process:
in "updateItem" the change is analyzed and the proper color is stored in an extra field (namely 214);
then, in "formatValues", the color is assigned as the "hot" background color to all the cells in the row (note that only changed cells will be highlighted).
Does this still work for the "last_price" field?
Other code is not relevant for you; the only relevant code is:
Code:
function updateItem(item, updateInfo) {
if (updateInfo == null) {
return;
}
var oldLast = updateInfo.getOldValue("last_price");
var newColor;
if (oldLast == null) { //first update for this item
updateInfo.addField(214,greenColor,true);
} else if (updateInfo.isValueChanged("last_price")) {
//at least second update
if (oldLast > updateInfo.getNewValue("last_price")) {
updateInfo.addField(214,redColor,true);
} else {
updateInfo.addField(214,greenColor,true);
}
}
}
function formatValues(item, itemUpdate) {
if (itemUpdate == null) {
return;
}
itemUpdate.setHotTime(600);
//choose the backgroundColor
var backC = (item % 2 == 1) ? "#eeeeee" : "#ddddee";
var backH = itemUpdate.getServerValue(214);
itemUpdate.setRowAttribute(backH,backC,"backgroundColor");
}
You seem to require two changes:
- The change of "last_price" should only affect the "last_price" cell; you can accomplish this by using the "setAttribute" API in place of the "setRowAttribute"; please find the details on these APIs here (the online web client APIs documentation root is http://www.lightstreamer.com/docs/cl...doc/index.html).
- The same code should be replicated for all the desired fields; this implies that you have to use more extra fields; you may prefer to name them by names (e.g. "last_price_color" in place of 214).
Bookmarks