| var grid, store, dataStore; |
| require([ "dojox/grid/DataGrid", "dojo/store/Memory", "dojo/data/ObjectStore", |
| "dojo/_base/xhr", "dojo/domReady!" ], |
| |
| function(DataGrid, Memory, ObjectStore, xhr) { |
| xhr.get({ |
| url : "../persistence/mysports-HTHL/query/Player.findByTeam;team=2", |
| handleAs : "json", |
| headers : { |
| "Accept" : "application/json" |
| }, |
| contentType : "application/json" |
| }).then(function(data) { |
| store = new Memory({ |
| data : data |
| }); |
| |
| dataStore = new ObjectStore({ |
| objectStore : store |
| }); |
| |
| grid = new DataGrid({ |
| store : dataStore, |
| query : { |
| id : "*" |
| }, |
| structure : [ { |
| cells : [ { |
| name : "ID", |
| field : "id" |
| }, { |
| name : "First Name", |
| field : "firstName" |
| }, { |
| name : "Last Name", |
| field : "lastName" |
| }, { |
| name : "Number", |
| field : "number" |
| } ] |
| } ] |
| }, "grid"); |
| |
| // since we created this grid programmatically, call startup to render |
| // it |
| grid.startup(); |
| }); |
| }); |