Announcement

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

    Is there a way to build datasource from JSON object array manually?

    Now I'm interacting with a existed web service. The web service reture a JSON object like this :
    {"success":true,"
    result":[{"manufacturer":"aaaa","productname":"bbbb","id":"8888"},
    {"manufacturer":"cccc","productname":"dddd","id":"9999"},
    ..............
    {"manufacturer":"xxxx","productname":"xxxx","id":"nnnn"},
    ]
    }
    I'm using GWT java overlay object to process the return JSON. So I have a java overlay object named product which is mapped to product of result property.
    Now this is my question. How can I build a smartgwt datasource from the products JSArray?
    BTW, I can not rebuild the server side web service code in order to generate a smartgwt standard JSON reponse.
    Thanks in advance!
    Last edited by recoco; 11 Jun 2010, 16:59.

    #2
    Call Record.convertToRecordArray(JavaScriptObject jsObj) passing the JavaScriptObject corresponding to the "result" array. This returns a Record array which you can pass to DataSource.setTestData(..).

    Sanjiv

    Comment


      #3
      Sanjiv, thank you very much! I had solved the problem using RestDataSource.

      Comment

      Working...
      X