PDA

View Full Version : Setting JsonView and DataModel data from existing JSON obj



slacker775
18 Jan 2007, 3:35 PM
I am currently pulling a set of data back via JSON and would like to be able to dish out specific branches of it to different objects, namely a JsonView and a Grid. For the JsonView, I currently do this in the 'load' event handler that gets the data:

this.projectsView.jsonData = data.projects;
this.projectsView.refresh();

And that seems to work, though if there is a better way, I'm all ears.

For the Grid, I'm trying:
var dm = this.grid.getDataModel();
dm.loadData(data);

and it seems to kinda of work, the grid adds the appropriate number of rows, but the data doesn't display. If I add a row, that row shows the default values, but if I click the row, I get errors in GridView.js about 'row has no properties' (from updateRows()).

I know the Grid is undergoing a major overhaul, so it may be best to just wait for that to start showing up, but maybe there are some other ideas on how to best accomplish this.