My current solution works so so by using an additional
fetchItemByIdentity(), but sometimes the children are only displayed in the
grid after clicking the node twice (async problem?). Furthermore, if
clicking on a node in the tree fetches the children anyway, why not just
notifying the grid that the tree fetched the children, but how?
dojo.connect(this.tree, 'onClick', this, function(item) {
this.showFolderContentInGrid(item);
});
/**
* Displays folder content in grid.
* @param {item} item selected folder
*/
showFolderContentInGrid: function(item) {
var store = this.store;
if (!store.getValue(item, 'dir')) {
return false;
}
var model = this.treeModel;
var grid = this.grid;
var ref;
if (store.hasAttribute(item, 'id')) {
ref = store.getValue(item, 'id');
}
else {
var ref = store.getValue(item, '$ref');
}
store.fetchItemByIdentity({
identity: ref,
onItem: function(item) {
var attr = model.childrenAttrs[0];
var items = store.getValues(item, attr);
grid.setItems(items); // BUG in grid? the very first time this is
called the grid is not refreshed!
},
onError: function(err) {
console.debug('error fetching store data for grid with ', err);
}
});
},
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/notify-grid-to-fetch-from-tree-with-JsonRestStore-tp854101p854101.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
In my case I'm listening for when the store changes, then I update my
second grid. But I experienced the same grid disappearing on every
other click that you are describing. I'm not sure if it's a bug or what.
-Chris
_______________________________________________
> ------------------------------------------------------------------------