hello everybody,
I have a problem with javascript. I don't know how to get the number of stock name. I want to generate automatically name stock. Ex: I have x stock name. and i want to display x stock name. But i can't do it. Please help me!
hello everybody,
I have a problem with javascript. I don't know how to get the number of stock name. I want to generate automatically name stock. Ex: I have x stock name. and i want to display x stock name. But i can't do it. Please help me!
I'm not sure I understand the question properly.
May you please expand it and provide an example of the information you own, the one you get from Lightstreamer and the one you would like to display?
EX: I have 100 stock name from Database and I use Adapter to post to server. In web client, how to get number of stock name to write in html. Thank you so much!
Sorry, but we can't really understand what you mean. What is the "number of stock name"?
In Ex, I have 10 line(10 stock name). And now, i need to write x line. Adapter will sent to client x line. How to web client write x line in html???for (var i = 1; i <= 10; i++) {
var suff = (i % 2 == 1) ? "A" : "B";
document.write('<tr class="lscold'+suff+'">');
document.write('<td nowrap style="text-align: left"><a href="#" onClick="return openPopup('+i+')"><img src="images/popup.gif" width="16" height="16" border="0" align="left" hspace="1" alt="Graphic Chart"><div class="stockname'+suff+'" source="lightstreamer" table="stocks" item="item'+i+'" field="stock_name">Loading...</div></a></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="last_price">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="time">-</div></td>');
document.write('<td><span source="lightstreamer" table="stocks" item="item'+i+'" field="#arrow"><img src="images/spacer.gif" width="20" height="8" border="0"></span></td>');
document.write('<td nowrap="nowrap"><div source="lightstreamer" table="stocks" item="item'+i+'" field="pct_change">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="bid_quantity">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="bid">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="ask">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="ask_quantity">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="min">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="max">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="ref_price">-</div></td>');
document.write('<td><div source="lightstreamer" table="stocks" item="item'+i+'" field="open_price">-</div></td>');
document.write('</tr>');
}
In a normal scenario, we assume that any back-end information is available to the Web Server, if needed.
Hence, the Web Server is still responsible for knowing what the supplied page is supposed to display.
In this case, if the page has to show all the available stocks,
the Web Server should ask to your feed for the list of available stocks,
so that the Web Server can compose the page
and make it show the stocks and ask Lightstreamer for the real time updates for those stocks.
However, if you find it easier to ask for the list of available stocks through Lightstreamer
(for instance, if you are using a simple feed simulator which is difficult to connect to your Web Server)
then your page could get the list by subscribing to a COMMAND mode item.
Obviously, your Data Adapter has to be extended, in order to supply this new item, according to the information it can get from the feed.
Your page, in order to handle the received list and subscribe to all the received stocks,
can take advantage of a MultiDynaMetapushTable,
as demonstrated in the predeployed Portfolio Demo example provided with the distribution package.
Thanks for your help!
Bookmarks