Closed ClementYap closed 10 years ago
First, there is not method model.clearCache()
. Second, the method store.setData()
is not observable. To refresh a cbtree you must use one of the cbtree stores and then reload the store, please see Reload Store
Wow... Many thanks. It works... Phew..... Thanks again
Hi, the first time it works. There are 2 buttons that each got data from mysql database by means of dojo.request. Both of the are working. I also have enabled property "clearOnClose". Whenever, the store is initialized, I am able to use both button to load the store for the first time. But in the second time, I again tried any button, the store is not loaded again.
Please see my function code:- function refreshStore(givenDB, givenCard, givenBatch) { request.post('list_tree.php', { data:{nameDB : givenDB, nameCard : givenCard, selectedBatch : givenBatch}, handleAs: "json" // JSON.parse is auto so JSON.parse is not needed ahead. }).then (function(response) { try { if(response.msg) { console.table(response.msg); console.debug("Loading into the store now!!"); storeA.close(); storeA.load({data:(response.msg), getChildren: function(object) { return this.query({parent: object.id}); } }); } } catch(e) { console.debug("Error: When refreshing tree, "+e); } }) }
The error prompted is "Error: When refreshing tree, TypeError: this.onLoadDeferred is undefined".
I am still looking for solutions or tips how to renew store with different set of data so that the tree is refreshed. Please advise. I am thinking of ..liken event or observable. like this as shown below but it does not work.
function refreshStore(givenBatch) { try { if (givenBatch.msg) { registry.byId("corner3").model.clearCache(); registry.byId("corner3").model.store.setData(givenBatch.msg); registry.byId("corner3").body.refresh(); } } catch (e) { alert("Error: When refreshing tree, " + e); } };
regards Clement