为什么Extjs 4.0.7 TreeStore会自动调用http delete方法?

时间:2011-10-25 13:26:16

标签: extjs extjs4 javascript-framework

我使用的是extjs 4.0.7。我正在我的应用程序中实现Ext.data.TreeStore。我在TreePanel上显示这些数据。我还有cutome菜单来添加节点。当我通过store.load()方法动态加载treeStore时,它会删除数据库中的所有数据。我的商店代码是:

Ext.define('Overdrive.store.BomTree', {
    extend: 'Ext.data.TreeStore',

    constructor: function(cfg) {
        var me = this;
        cfg = cfg || {};
        me.callParent([Ext.apply({
            storeId: 'BomTree',
            autoLoad:true,

            proxy: {
                type: 'rest',
                url: '/abc',
                reader: {
                    type: 'json',
                    idProperty: 'oid'
                },
                writer: {            
                    type: 'json',
                    successProperty: 'success'
                },
                headers: {
                    'Content-type': 'application/json',
                    'Accept': 'application/json' 
                }

            },


            fields: [
                {
                    name:'id'
                },

                {
                    name: 'qty'
                },
                {
                    name:'oid'
                },
                {
                    name:'parent_id'
                },
                {
                    name:'text'
                }
            ]
        }, cfg)]);
    }
});

商店正在按预期第一次加载数据。任何人都可以告诉我这应该是什么问题?

1 个答案:

答案 0 :(得分:1)

前几天我碰巧在论坛中发现了这个问题:http://www.sencha.com/forum/showthread.php?151211-Reloading-TreeStore-adds-all-records-to-store-getRemovedRecords

看起来这是一个未解决的问题。但是,有人在你可能会尝试的论坛上添加了修复程序。