Thanks Dario, can u explain more about java script code inside default.html?

---- StockList demo code. File "default.html" ------

var redColor = "#f8b87a";
var greenColor = "lightgreen";

function updateItem(item, updateInfo) {
if (updateInfo == null) {
return;
}

//My understand : if column pct_change has value changed, if the value > -1 show quotes_down.gif image, else show quotes_up.gif image.
In function updateInfo.addField(16, imgDown) , i can use 114, 115, 116 like u said and changed to addField(116, imgDown). Is it correct?


if (updateInfo.isValueChanged(3)) {
var val = updateInfo.getNewValue(3);
if (val.indexOf("-") > -1) {
updateInfo.addField(16,imgDown);
} else {
updateInfo.addField(16,imgUp);
}
}

var oldLast = updateInfo.getOldValue(1);
var newColor;

if (oldLast == null) { //first update for this item
updateInfo.addField(14,greenColor,true);
//no fade for snapshot
if (doFade) {
updateInfo.addField(15,"OFF",true);
}
} else if (updateInfo.isValueChanged(1)) {
//at least second update
//My understand : if column pct_change has value changed, if the new value > the old value, set color = green, else set color = red. Is it correct?
if (oldLast > updateInfo.getNewValue(1)) {
updateInfo.addField(14,redColor,true);
} else {
updateInfo.addField(14,greenColor,true);
}
if (doFade) {
updateInfo.addField(15,"ON",true);
}
}
}

---------
function formatValues(item, itemUpdate) {
if (itemUpdate == null) {
return;
}
// itemUpdate.getServerValue(15) == "ON" --> What does it means?
if (doFade) {
if (itemUpdate.getServerValue(15) == "ON")
{
itemUpdate.setHotToColdTime(300); --> i don't understand. }
}
itemUpdate.setHotTime(600);

if (itemUpdate.getServerValue(13) == "inactive") {
carryBackUnchanged(itemUpdate); --> i don't understand here
itemUpdate.setRowAttribute("#808080","#808080","co lor");
} else {
// itemUpdate.getFormattedValue(13) --> what does it means?
if (itemUpdate.getFormattedValue(13) != null) {
carryBackUnchanged(itemUpdate);
itemUpdate.setRowAttribute("#000000","#000000","co lor");
itemUpdate.setAttribute(12,"#000080","#000080","co lor");
}

//choose the backgroundColor
var backC = (item % 2 == 1) ? "#eeeeee" : "#ddddee";
var backH = itemUpdate.getServerValue(14);
itemUpdate.setRowAttribute(backH,backC,"background Color");

//choose the "change" field stylesheet
var newChng;
// i don't understand code below
if ((newChng = itemUpdate.getFormattedValue(3)) != null) {
var hotTxtCol = (newChng.charAt(0) == '-') ? "#dd0000" : "#009900";
itemUpdate.setAttribute(3,"black",hotTxtCol,"color ");
itemUpdate.setAttribute(3,"bold","bold","fontWeigh t");
}

itemUpdate.setAttribute(12,backC,backC,"background Color");
}