nonie
nonie

Reputation: 97

Updating dojox.grid.DataGrid

I have a dojox.grid.DataGrid configured and I want to populate a data grid with different values when a user clicks a button.

I have tried the following code but it does not work:

var employees2 = [
  {name:"Jane", department:"engineering"},
  {name:"Mary", department:"engineering"},
  {name:"Julie", department:"sales"}
];

console.info("grid is "+grid.toString());
employeeStore2 = new dojo.store.Memory({data:employees2, idProperty: "name"});

grid.setStore(employeeStore2);

employeeStore2.close();

I have setup the example here: http://jsfiddle.net/nonie/kx72T/

Any help would be great.

Upvotes: 1

Views: 1645

Answers (1)

Showtim3
Showtim3

Reputation: 976

In your example, the event onclick button doesn't work....

I think in showList2 method, you should write something like this

**employeeStore2 = new dojo.store.Memory({
    data: employees2,
    idProperty: "name"
});

grid.setStore(dojo.data.ObjectStore({objectStore: employeeStore2}));
grid.update();**

Upvotes: 1

Related Questions