Results 1 to 5 of 5

Hybrid View

  1. #1
    Member
    Join Date
    Dec 2008
    Location
    Bangalore
    Posts
    20

    Smile

    Hi Alessandro,

    Thanks for the reply. I get the point.

    Regards,
    Shreyas

  2. #2
    Member
    Join Date
    Feb 2009
    Location
    Pyrmont
    Posts
    25
    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:

    Code:
    <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

  3. #3
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    the problem with the json.js file is that such library extends the Object's prototype that in turn breaks our code.

    If you use the updated version of the json library (http://www.JSON.org/json2.js ) no conflicts will occur.

    hope that helps.

 

 

Similar Threads

  1. Replies: 1
    Last Post: March 11th, 2010, 03:53 PM
  2. Replies: 0
    Last Post: March 8th, 2010, 10:27 AM
  3. Replies: 4
    Last Post: August 14th, 2009, 03:28 AM
  4. Bandwidth and event pushing
    By churrusco in forum General
    Replies: 10
    Last Post: May 8th, 2007, 02:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 05:22 PM.