-
July 3rd, 2008, 09:41 AM
#5
Hi Dario,
1. I want to hide values that come as "NaN" from the Server. I tried using setFormattedValue(i,"");, but it doesn't effect.
// format _change
var newValue = itemUpdate.getFormattedValue("_change");
if ((isNaN(newValue)) || (newValue == null))
{
itemUpdate.setFormattedValue("_change","");
}
if (newValue != null)
{
var formattedVal = parseFloat(newValue);
if (formattedVal > 0)
{
formattedVal = "+" + formattedVal;
}
if ((itemUpdate.getServerValue("last_price")) == itemUpdate.getServerValue("ceiling"))
{
//ceiling price
formattedVal = "CE " + formattedVal;
}
else if ((itemUpdate.getServerValue("last_price")) == itemUpdate.getServerValue("floor"))
{
//floor price
formattedVal = "FL " + formattedVal;
}
itemUpdate.setFormattedValue("_change",formattedVa l);
} // end of if (newValue != null)
}
2. I want to format "bid1", "bid1vol", ..., "bid3vol" follow the rules :
loop from "bid1" field --> "bid3" field
{
if (bid1 price < reference price)
{
filling "bid1", "bid1vol" field by red color.
}
else if (bid1 price > reference price)
{
filling "bid1", "bid1vol" field by red color.
}
else if (bid1 price = reference price)
{
filling "bid1", "bid1vol" field by yellow color.
}
}
Like this (in my NonVisualTable code --> http://www.gls.com.vn:8080/priceonline/hose.html) :
-------
var PriceRe=parseFloat(itemUpdate.getServerValue("ref_ price"));
// format bid1vol, bid1 price, bid2vol, bid2 price, bid3vol, bid3 price
for (var i=4;i<=9;i+=2)
{
//ATO, ATC
if (isNaN(itemUpdate.getServerValue(i)))
{
itemUpdate.setAttribute(i,"#FFFFFF","#FFFFFF","col or");
itemUpdate.setAttribute(i+1,"#FFFFFF","#FFFFFF","c olor");
}
else if (cf(itemUpdate.getServerValue(i))==PriceRe)
{
itemUpdate.setAttribute(i,yellowColor,yellowColor, "color");
itemUpdate.setAttribute(i+1,yellowColor,yellowColo r,"color");
}
else if (cf(itemUpdate.getServerValue(i))<PriceRe)
{
itemUpdate.setAttribute(i,redColor,redColor,"color ");
itemUpdate.setAttribute(i+1,redColor,redColor,"col or");
}
else if (cf(itemUpdate.getServerValue(i))>PriceRe)
{
itemUpdate.setAttribute(i,greenColor,greenColor,"c olor");
itemUpdate.setAttribute(i+1,greenColor,greenColor, "color");
}
}
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 03:49 AM.
Bookmarks