Refreshing a dojo datagrid json store

var customerGrid = new dojox.grid.DataGrid({
  query: { customer_id: '*' },
  store: customerJsonStore,
  structure: layout,
  queryOptions: {ignoreCase: true},
  rowsPerPage: 20
}, 'gridNode');

function loadSpecificCustomerIntoGrid(selectedCustomerId) {
  // You can refresh a grid by updating the json store behind it
  customerJsonStore.fetch({
    query: { customer_id: selectedCustomerId },
    onComplete: function(items, result) {
      // And then calling sort on the grid
      customerGrid.sort();
    }
  });
}
This entry was posted in General and tagged , , , , . Bookmark the permalink.
  • http://higginsforpresident.net/ Peter Higgins

    Close is in the “data API” docs, and is not specific to a special store. The ambiguity of only defining and API and allowing people to create their own data stores around that API makes it difficult to explain in Docs things such as the campus cookie linked did. It was also written _before_ the close() method was implemented, and offered a comparable solution for pre-1.2 users.

    http://docs.dojocampus.org/dojo/data/api/Read#close

    The reason for the dojocampus.org “cookies” like that are to have a quick place to explain a topic in a static way when asked online (like in #dojo) … We’ve recently opened up the documentation effort and better enabled the community to participate, and a lot of the quality cookies are in fact being migrated into the static docs. Specific topics are being linked from appropriate doc pages. DojoCampus is more or less an official extension to Dojo Toolkit, and we’re working to better communicate that idea, and have better IA for the various outlets. For instance, aggregating “cookies” tagged “dojo.style” would appear as external resources on the “dojo.style” API and book pages …

    The work in progress is docs.dojocampus.org, if you have not found that already. It will be 100% complete with the release of 1.3, and exports currently to a 600+ page PDF for offline reading. If you’d like a preview, drop me a line.

  • http://higginsforpresident.net Peter Higgins

    Close is in the “data API” docs, and is not specific to a special store. The ambiguity of only defining and API and allowing people to create their own data stores around that API makes it difficult to explain in Docs things such as the campus cookie linked did. It was also written _before_ the close() method was implemented, and offered a comparable solution for pre-1.2 users.

    http://docs.dojocampus.org/dojo/data/api/Read#close

    The reason for the dojocampus.org “cookies” like that are to have a quick place to explain a topic in a static way when asked online (like in #dojo) … We’ve recently opened up the documentation effort and better enabled the community to participate, and a lot of the quality cookies are in fact being migrated into the static docs. Specific topics are being linked from appropriate doc pages. DojoCampus is more or less an official extension to Dojo Toolkit, and we’re working to better communicate that idea, and have better IA for the various outlets. For instance, aggregating “cookies” tagged “dojo.style” would appear as external resources on the “dojo.style” API and book pages …

    The work in progress is docs.dojocampus.org, if you have not found that already. It will be 100% complete with the release of 1.3, and exports currently to a 600+ page PDF for offline reading. If you’d like a preview, drop me a line.

  • http://kenneth.kufluk.com/ Kenneth

    Sounds interesting. I didn’t see the campus. Will check it out.

  • http://kenneth.kufluk.com Kenneth

    Sounds interesting. I didn’t see the campus. Will check it out.

  • http://kenneth.kufluk.com/ Kenneth

    In summary, just in case anyone is looking for this, you have to close the grid store, then create a new one, then sort the grid to refresh its content.
    Pretty long winded.

    grid.store.close();
    grid.store = new dojo.data.ItemFileReadStore({ url: “whatever.”+variable+”.json”, clearOnClose: true });
    grid.sort();

  • http://kenneth.kufluk.com Kenneth

    In summary, just in case anyone is looking for this, you have to close the grid store, then create a new one, then sort the grid to refresh its content.
    Pretty long winded.

    grid.store.close();
    grid.store = new dojo.data.ItemFileReadStore({ url: “whatever.”+variable+”.json”, clearOnClose: true });
    grid.sort();

  • http://www.k9stud.com Puppies for Sale

    DojoCampus is more or less an official extension to Dojo Toolkit, and we’re working to better communicate that idea, and have better IA for the various outlets.

  • Patryk Jar

    Both links don’t work :/

    have you got any idea how to reload one branch of tree, using JsonRestStore?