TehHector
is it possible to make lightstreamer make update on 2 items that have the same name on the same page.
example:
item 1:
<span source="lightstreamer" table="mytable" item="timeItem" field="time"></span>
item 2:
<div source="lightstreamer" table="mytable" item="timeItem" field="time"></div>
it work if only one of them is added, if i add the other item on the same page none gets updates.
Mone
Hi,
there is a limitation so that if two cells pertain to the same table, same item and same flled, only one of them will be updated by the client library.
Your case looks like the one described above as you show us two cells with the same table/item/field names, so that it's strange that none of them gets updates.
In any case the solution for such a case is quite simple:
just declare the two cells so that one of them uses an extra field:
[SYNTAX="HTML"]<span source="lightstreamer" table="mytable" item="timeItem" field="time"></span>
<div source="lightstreamer" table="mytable" item="timeItem" field="#extra_time"></div>
[/SYNTAX]
then copy the value of the actual field to the extra one during the execution of the onItemUpdate
[SYNTAX="JS"]
myTable.onItemUpdate = function(index,obj,name) {
[...]
if (obj.isValueChanged("time")) {
obj.addField("#extra_time",obj.getNewValue("time"),true);
}
[...]
}
[/SYNTAX]
let me know if you have any doubt or if your problem is different.