1

Can some one pls tell me how to update data grid using a json object. My data grid is created as beleow.

var grid4 = new dojox.grid.DataGrid({
                    query : {
                        number: '*'
                    },
                    clientSort : true,
                    rowSelector : '20px',
                    structure : layout4
                }, document.createElement('div'));
        grid4.setStore(jsonStore);
        dojo.byId("gridContainer4").appendChild(grid4.domNode);
        grid4.startup();

initially jsonStore applies to the grid without any problem. But later I get json object something similar to following.

data = {
            "results" : {
                "info" : [{
                            "number" : "12.11",
                            "product" : "KALA,
                            "Qty" : "0.00" }]
            }
        }

So I need to apply these data to my grid. I dont know how to do it can some one plese help me to data. Thanks in advance.

nath
  • 2,848
  • 12
  • 45
  • 75

2 Answers2

1

The store should contain the "data" key, as you correctly did, and the corresponding object should have the "items" key. Have a look also at my answer here: Dojo grid nested json

Community
  • 1
  • 1
perissf
  • 15,979
  • 14
  • 80
  • 117
0

You can add new items to the grid by adding the item to the underlying data store :

grid.store.newItem(jsonItem);
grid.store.save()
Alex.Bullard
  • 5,533
  • 2
  • 25
  • 32