项目采用 MVC 结构

Ext.define('MyToolbox.store.am.Accounts',{
    extend: 'Ext.data.Store',
    model: 'MyToolbox.model.am.Account',
    autoSync: true,
    // 在 Store config 块中配置 params 块
    config: {
        params: {
            typeId: 0
        }
    },
    listeners:{
        // 每次 load 前,装载 params 块中的参数
        beforeload: function (store, options) {
            //console.log(this.getParams());
            Ext.apply(store.proxy.extraParams, this.getParams()); 
        }
    },
// Controller 中的代码
onNodeSelect: function(tp, record) {
        // 获取 store
        var store = this.getStore('am.Accounts');
        // 设置 params 块中的参数
        store.setParams({typeId: record.get('id')});
        store.loadPage(1);
    },

狂点分页工具栏上的刷新 typeId 参数还在. 

// 即使你又增加了新的参数,
store.setParams({test: 'demo'});
// 分页刷新,原来的参数还在

 posted on 2013-12-11 22:53  AlexCK  阅读(675)  评论(0编辑  收藏  举报