繁体   English   中英

如何将价值传递给其他商店

[英]how to pass value to other store

我正在使用有关体系结构的文章http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/

我在获得城市名称的地方有这个功能

  function resellerwindow(cityname) {
        // render the grid to the specified div in the page
        // resellergrid.render();
        Application.ResellerGrid.cityname=cityname;
       console.log(Application.ResellerGrid.cityname);
        var win = new Ext.Window({
             items:{xtype:'ResellerGrid'}
        });
        win.show();
    }

我要传递给转销商商店的城市名称是我的转销商类别。

Application.ResellerGrid = Ext.extend(Ext.grid.GridPanel, {
     border:false
     ,cityname : ''
    ,initComponent:function() {
        var config = {
            store:new Ext.data.JsonStore({
                // store configs
                autoDestroy: true,
                autoLoad :true,
                url: 'api/index.php?_command=getresellers&city='+this.cityname,
                storeId: 'getresellerscount',
                // reader configs
                root: 'reseller',
                idProperty: 'firstname',
                fields: [
                   {name: 'firstname'},
                   {name: 'lastname'},
                   {name: 'mobile'},
                   {name: 'email'},
                   {name: 'tmecode'},
                   {name: 'tmename'},
                   {name: 'updatedon'},
                   {name: 'apptype'},
                   {name: 'alloctype'},
                   {name: 'empparent'},
                   {name: 'irodeferred'}
                ]
            })
            ,columns: [
                {
                    id       :'firstname',
                    header   : 'First Name', 
                    width    : 120, 
                    sortable : true, 
                    dataIndex: 'firstname'
                },
                {
                    id       :'lastname',
                    header   : ' Last Name', 
                    width    : 100, 
                    sortable : true, 
                    dataIndex: 'lastname'
                },
                 {
                    id       :'mobile',
                    header   : 'Mobile', 
                    height : 50,
                    width    : 100, 
                    sortable : true, 
                    dataIndex: 'mobile'
                },
                {
                    id       :'email',
                    header   : 'E-Mail', 
                    width    : 100, 
                    sortable : true, 
                    dataIndex: 'email'
                },
                {
                    id       :'tmecode',
                    header   : ' TME Code', 
                    width    : 100, 
                    sortable : true, 
                    dataIndex : 'tmecode'
                },
                {
                    id       :'updatedon',
                    header   : ' updatedon', 
                    width    : 100, 
                    sortable : true, 
                    dataIndex: 'updatedon'
                },
                {
                    id       :'empparent',
                    header   : ' empparent', 
                    width    : 100, 
                    sortable : true, 
                    dataIndex: 'empparent'
                }
            ]
          ,plugins :[]
          ,viewConfig :{forceFit:true}
          ,tbar :[]
          ,bbar :[]
          ,height : 250
          ,width : 860
           ,title : 'Reseller Grid'
        }; // eo config object

        // apply config
        Ext.apply(this, Ext.apply(this.initialConfig, config));

        Application.ResellerGrid.superclass.initComponent.apply(this, arguments);
    } // eo function initComponent
    ,onRender:function() {
        // this.store.load();

        Application.ResellerGrid.superclass.onRender.apply(this, arguments);
    } // eo function onRender
});

Ext.reg('ResellerGrid', Application.ResellerGrid);

我如何通过在ResellerGrid类中创建属性cityname并将其设置在函数中尝试将城市名称传递给api,但是它不起作用它将如何起作用,这很重要

完成者:尝试过此工作:)

  function resellerwindow(cityname) {

        var win = new Ext.Window({
             items:{xtype:'ResellerGrid','cityname':cityname}
        });
        win.show();
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM