While working on a problem with a "DynaScrollTable" (as described in a
separate thread) we ran into another problem with the "showValues()"-function and clearing of the data table.
We use the "showValues()"-function to populate the "DynaScrollTable" with initial values after page load. This worked great, the page loads with an empty "DynaScrollTable", then the table gets populated with highlighting (Hot/ColdPhase) with the latest 10 entries (written into a <script>-block by the webserver), and afterwards new updates get pushed by the Lightstreamer..
While working on our original problem I noticed that the particular website still used a heavily outdated version of the web client library (build 1313), so we switched to the newest library build (1355.3) to see if our initial problem had been fixed in the newer version - unfortunately it did not help with our problem, but instead we noticed an additional problem with the newer library build - right after the "DynaScrollTable" was populated by the "showValues()"-calls the whole table got cleared, and then slowly filled when normal updates were received.
There's a "setClearOnAdd()"-method in the "VisualTable"-class, and the default is to clear every table after a call to "PushPage.addTable()", but our JavaScript-code explicitely sets "myDynaScrollTable.setClearOnAdd(false)" before the "addTable()"-call, so that should be alright.
The
documentation mentions an exception for some data tables:
Some kinds of data tables require that the screen table is cleared before displaying data coming from the data table. This applies to DynaScrollTable, MetapushTable, DynaMetapushTable and MultiDynaMetapushTable. With data tables of these kinds, this setting is ignored and the screen table contents are always cleared upon reuse of a screen table for such a data table.
As we use a "DynaScrollTable" this exception is relevant in our case, but I still don't understand why the behaviour is different between the different build numbers of the web client library. I looked through the Changelog, and the only comment I found related to "setClearOnAdd" was this:
4.3 build 1346
[...]
Fixed a bug that might prevent screen table reuse from working correctly.
A second addTable call on the same table ID could throw an exception in case
some cell was dynamically removed in the meantime and one of
setClearOnAdd/Remove/Disconnected was called with true.
As we only do a single call to "addTable()" I don't think this bugfix affects our use case.
Our relevant Javascript-code looks like this (a little bit simplified):
[SYNTAX="JS"]
var myDynaScrollTable = new DynaScrollTable(["SingleItemName"], ["timestamp","identifier","number1","number2"], "MERGE");
//...
myDynaScrollTable.setClearOnAdd(false);
myPushPage.addTable(myDynaScrollTable, "DynaScrollTableName");
//...
myDynaScrollTable.showValues("SingleItemName", {timestamp:"18:21:27",identifier:"First Identifier",number1:"123.45",number2:"678.9"});
myDynaScrollTable.showValues("SingleItemName", {timestamp:"18:21:28",identifier:"Second Identifier",number1:"65.432",number2:"98.7"});
myDynaScrollTable.showValues("SingleItemName", {timestamp:"18:21:29",identifier:"Third Identifier",number1:"76",number2:"34.5"});
//...and 7 more...
[/SYNTAX]
I don't really have an explanation why the table gets cleared after being populated via "showValues()" when we use the new version of the webclient library (build 1355.3) and why it does
not happen with the old version (build 1313).
The calls to "showValues()" are executed only
afterthe table has been brought into the "running" state by the "addTable()"-call, so the clearing of the data table should already have happened according to the
documentation on "setClearOnAdd()" - or am I mistaken?
Do I have to put the "showValues()"-calls into a "myDynaScollTable.onStart()"-function? The documentation for "onStart" says that...
[...]In case of a VisualTable, the cleaning of the visual table content has already been performed, according with the VisualTable.setClearOnAdd(), VisualTable.setClearOnRemove() and/or VisualTable.setClearOnDisconnected() settings.
Would this mean that the calls to "showValues" will be executed later than they are now? We try to populate the data table with the initial data as quickly as possible, so I would like to prevent any additional delay..