Announcement

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

    Tree Grid, XJSONDataSource, JSON refresh problem

    Hello All,

    I have a grid of data, with an add button. When I click the button, the user fills in a form, which creates a new record add adds it to the grids data source, like so:

    Code:
    	Record record = new Record();
    	record.setAttribute("...", ...);
    	dataSource.addData(record);
    This causes the data source to post a request to the server. The server then adds the record using the data that was sent.

    All this is going great.

    My problem is that the data is not added into the table once the response is received back from the server (if you refresh the whole table it appears).

    The data that loads the grid initially is something like this (its xpath is set to /base_group/item)

    Code:
    isc.Comm._scriptIncludeReply_13 ({"base_group": [ 
         {
           "id": "5", 
           "name": "Base Group",
            "item": [{
                     "id": "1895", 
                      "name": "An item",
                      "description": "A description"
             }, ...<more items here>....]
     }]})
    And the code i am sending back when an item is added looks something like this:

    Code:
    isc.Comm._scriptIncludeReply_15 ({    "base_group" : [
            {
                "id": "5",
                "name": "Base Group",
                "item": [{
                    "id": "9111",
                    "name" : "New Item",
                    "description": "New Item Description." 
                }]
            } 
        ]})
    The response comes back, the contacting server dialog closes, but the table does not update with the new record. I cant see what im doing wrong, or how to debug it.

    Any help would be much appreciated!

    #2
    Check the FAQ in the SmartGWT Forum about grids not updating. The same concerns and troubleshooting steps apply to SmartClient.

    Comment


      #3
      I get this INFO log in the Developer Console:

      Code:
      15:34:34.512:INFO:RPCManager:rpcResponse(unstructured) results -->{base_group: Array[1]}<--
      How am I supposed to debug this? What information is it missing? Ive tried as many combinations I can think of and nothing works. Ive tried adding to the data set and to the tree. The thing is, that in that data source ive set the xpath to /base_group/item, so what should i be returning? Just the item? Or the base group as well? The base group isnt being added, just the item, but otherwise how does it know its supposed to be in that base group?

      Comment

      Working...
      X