-
July 1st, 2008, 09:04 AM
#1
format value in VisualTable
Hi,
I'm going to http://app.lightstreamer.com/GridDemo/ and save as *.html, and modified something --> http://www.gls.com.vn:8080/priceonline/test.htm
In GridDemo source (before i modified) :
//////////////////////////Format callbacks
function updateItem(item, updateInfo) {
if (updateInfo == null) {
return;
}
if (updateInfo.isValueChanged("pct_change")) {
var val = updateInfo.getNewValue("pct_change");
}
var oldLast = updateInfo.getOldValue("last_price");
var newColor;
if (oldLast == null) { //first update for this item
updateInfo.addField("color",upColor,true);
updateInfo.addField("illuminate","OFF",false);
} else if (updateInfo.isValueChanged("last_price")) {
//at least second update
var newPrice = updateInfo.getNewValue("last_price");
if (oldLast > newPrice) {
updateInfo.addField("color",downColor,true);
} else {
updateInfo.addField("color",upColor,true);
}
}
}
-------
Here my changed :
-------
var redColor = "F70033"
var greenColor = "2EFF00";
var yellowColor = "#FFFF00";
function updateItem(item, updateInfo)
{
....
var oldLast = updateInfo.getOldValue("last_price");
var newColor;
if (oldLast == null)
{
//first update for this item
updateInfo.addField("color",greenColor,true); //updateInfo.addField("illuminate","OFF",false);
}
else if (updateInfo.isValueChanged("last_price"))
{
//at least second update
var newPrice = updateInfo.getNewValue("last_price");
if (oldLast > newPrice)
{
updateInfo.addField("color",redColor,true);
}
else if (oldLast < newPrice)
{
updateInfo.addField("color", greenColor,true);
}
else if (oldLast == newPrice)
{
updateInfo.addField("color",yellowColor,true);
} }
}
--------
It didn't show color when "last_price" field has changed. What's wrong?
Similar Threads
-
By genkijo in forum Client SDKs
Replies: 1
Last Post: July 20th, 2010, 09:20 AM
-
By cbrogliato in forum Client SDKs
Replies: 6
Last Post: May 8th, 2010, 09:14 PM
-
By hofmanna in forum Client SDKs
Replies: 3
Last Post: January 21st, 2010, 12:25 PM
-
By tuongkha in forum Client SDKs
Replies: 19
Last Post: July 8th, 2008, 09:16 AM
-
By bayu in forum Client SDKs
Replies: 1
Last Post: December 17th, 2007, 10:14 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:08 PM.
Bookmarks