While updating data of a dojo tree using a REST Store I have to change the name of the item. caching is avoiding this change for items already used in the tree. How to disable caching. Here is a part of the code:
var prod= {
store: null,
model: null,
tree: null,
init: function() {
this.store = new dojox.data.JsonRestStore({
target: 'jtf-products-REST.php',
labelAttribute: "name"
});
this.model = new dijit.tree.ForestStoreModel({
store: this.store,
deferItemLoadingUntilExpand: true,
rootId: "products",
rootLabel: "Products",
query: {},
childrenAttrs: ['children']
});
}};
//...
dojo.addOnLoad(function() {
prod.init();
prod.tree = new dijit.Tree({
model: prod.model,
dndController: dijit.tree.dndSource,
checkAcceptance:never,
persist: false
}, 'products_tree');
prod.tree.startup();
/...
function filterProducts() {
if (keyword = prompt("input")) {
dijit.byId('products_tree').destroy(true);
dojo.xhrPost({
url: 'jtf-products.php',
content: {
key: keyword,
type:'products'
},
//preventCache: true,
load: function(response) {
dojo.byId('numberofproducts').innerHTML=response+" products";
tree=prod.tree
tree._itemNodesMap = {};
tree.rootNode.state = "UNCHECKED";
tree.model.root.children = null;
if (tree.rootNode) {
tree.rootNode.destroyRecursive();
}
tree._load();
//...
Thank you.
Try this:
this.store = new dojox.data.JsonRestStore({
target: 'jtf-products-REST.php?_dc=' + new Date().getTime(),