Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Reading data from JSON String

    Hi,

    I'm currently using SmartGWT 2.5 LGPL.

    I have modified the JSON String a little bit and now it looks like...

    Code:
    {"response":
    {"data":[{ ~~ some data ~~}],
    "endRow":15,"startRow":0,"status":0,"totalRows":15,
    "table":{"column":[{"validator":["justsomevalidstuff2.1"],"valuemap":["valuemap2"],"name":"somename"},{"validator":["justsomevalidstuff2.2"],"valuemap":["valuemap2"],"name":"somename2"},{"validator":["justsomevalidstuff2.3"],"valuemap":["valuemap2"],"name":"somename3"}],"name":"CircuitMgwGrid2"}}}
    i've tried stuff like

    Code:
    grid.addDataArrivedHandler(new DataArrivedHandler() {
    			public void onDataArrived(DataArrivedEvent event) {
    				SC.Say(((CustomGrid) grid).getds().getAttribute("table")));
    
    // or grid.getDataSource().getAttribute("table");  or sth else
    				
    			}
    		});
    i also tried to map the data to a DataSourceTextField via setValueXPath but that also didn't work i just wanna get this ("table":{"column":[{"validator":["justsomevalidstuff2.1"],"valuemap":["valuemap2"],"name":"somename"},{"validator":["justsomevalidstuff2.2"],"valuemap":["valuemap2"],"name":"somename2"},{"validator":["justsomevalidstuff2.3"],"valuemap":["valuemap2"],"name":"somename3"}],"name":"SomeGridName"}}}) line out of the JSON String.


    Some additional info... The data is sent via a RestDataSource to the Client.

    Anybody got an idea how to get this data out of the JSON String?
    Last edited by d2k; 5 Sep 2012, 08:25.
Working...
X