Hello,
I'm attempting to use JSON and a NonVisualTable on the client side - but I seem to be having trouble with including the json.js file (e.g. using
http://www.json.org/json.js) with the lightstreamer js files.
The updates are working as expected when I don't include the json.js file, but the item updates don't seem to be getting picked up when the json.js is included into the page.
This is the set up I have:
<html>
<head>
<title></title>
<script src="js/json.js" type="text/javascript"></script>
<script src="ls/lscommons.js" type="text/javascript"></script>
<script src="ls/lspushpage.js" type="text/javascript"></script>
</head>
<body>
<div source="lightstreamer" table="test" item="item-test" field="fieldA" id="fieldA">
loading...
</div>
<script>
var page = new PushPage();
page.onEngineCreation = function(engine) {
engine.connection.setAdapterName("TEST_ADAPTER");
engine.changeStatus("STREAMING");
}
page.bind();
page.createEngine("TestApp", "LS", "SHARE_SESSION");
var group = ["item-test"];
var schema = ["fieldA"];
var pushtable = new NonVisualTable(group, schema, "MERGE");
pushtable.setSnapshotRequired(true);
// callback that receives the updates from the Server
pushtable.onItemUpdate = function (item, updateInfo) {
//alert("update received");
if (item == null) {
//alert("item is empty");
return;
}
if (updateInfo == null) {
//alert("updateInfo is empty");
return;
}
var value = updateInfo.getNewValue("fieldA");
var fieldADiv = document.getElementById("fieldA");
fieldADiv.innerHTML = value;
//todo: retrieve properties from the JSON obejct
};
//add the table to the page
page.addTable(pushtable, "test");
</script>
</body>
</html>
Is there something else I need to include to allow JSON to be used?
Many Thanks,
C