如何防止在dojox / data / JsonRestStore上缓存?

问题描述 投票:0回答:1

使用REST商店更新dojo树的数据时,我必须更改项目名称。缓存可避免对树中已使用的项目进行此更改。如何禁用缓存。这是代码的一部分:

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();
            //...

谢谢。

javascript dojo jsonreststore
1个回答
0
投票

尝试一下:

this.store = new dojox.data.JsonRestStore({
   target: 'jtf-products-REST.php?_dc=' + new Date().getTime(),
© www.soinside.com 2019 - 2024. All rights reserved.