+ -
当前位置:首页 → 问答吧 → extjs4.0 MVC 变更proxy的url 以及查询条件

extjs4.0 MVC 变更proxy的url 以及查询条件

时间:2011-09-21

来源:互联网

数据模型
JScript code

Ext.define('WLCSP.ERP.models.CompanyModel',{
    extend:'Ext.data.Model',
    fields:[
        {name:'AutoID',type:'int'},
        {name:'CompanyNO',type:'string'},
        {name:'CompanyName',type:'string'},
        {name:'Tel',type:'string'},
        {name:'Address',type:'string'},
        {name:'AddressEng',type:'string'},
        {name:'Postcode',type:'string'},
        {name:'Remark',type:'string'},
        {name:'Creator',type:'string'},
        {name:'CreatedTime',type:'datetime'},
        {name:'DeletedBy',type:'string'},
        {name:'DeletedTime',type:'datetime'},
        {name:'Deleted',type:'boolean'}
    ]
});



数据源
JScript code
 
Ext.define('WLCSP.ERP.stores.CompanyStore',{
    extend    : 'Ext.data.Store',
    singleton : true,
    requires  : ['WLCSP.ERP.models.CompanyModel'],
    model     : 'WLCSP.ERP.models.CompanyModel',
    constructor : function() {
        this.callParent(arguments);
        this.loadData([]);
    },
    proxy: {
        type: 'ajax',
        url: 'listCompany.action',
        reader: {
            type: 'json',
            root: 'companylist',
            successProperty: 'success'
        }
    },
    autoLoad: false
});



grid组件
JScript code

Ext.define('WLCSP.ERP.views.CompanysGridPanel', {
    extend   : 'Ext.grid.Panel',
    alias    : 'widget.CompanysGridPanel',
    requires : ['WLCSP.ERP.stores.CompanyStore'],
    initComponent : function() {
        this.store   = WLCSP.ERP.stores.CompanyStore;  //  grid组件的store已经固定,但需要通过一些查询条件查不同的数据,通过当前的store:WLCSP.ERP.stores.CompanyStore   
        this.columns = this.buildColumns();
        this.callParent();
    },
    buildColumns : function() {
        return [{header:'AutoID',dataIndex : 'AutoID',hidden:true},
            {header:'CompanyNO',dataIndex : 'CompanyNO',width: 70},
            {header:'CompanyName',dataIndex:'CompanyName',width: 70},
            {header:'Tel',dataIndex:'Tel',width:70},
            {header:'Address',dataIndex:'Address',width:70},
            {header:'AddressEng',dataIndex:'AddressEng',width:70},
            {header:'Postcode',dataIndex:'Postcode',width:70},
            {header:'Remark',dataIndex:'Remark',width:70},
            {header:'Creator',dataIndex:'Creator',width:70},
            {header:'CreatedTime',dataIndex:'CreatedTime',width:70},
            {header:'DeletedBy',dataIndex:'DeletedBy',width:70},
            {header:'DeletedTime',dataIndex:'DeletedTime',width:70},
            {header:'Deleted',dataIndex:'Deleted',width:70}];
    }
});



不知道如何去实现proxy,实现功能类似与extjs2的proxy,如下面代码
JScript code

//数据源提取数据
dsMaterialOutsourcingList.proxy = new Ext.data.HttpProxy({
        url:'MaterialOutsourcingData.jsp?DbType=SearchLoad&PN=' + Ext.getCmp("txt_pn_materialoutsourcingsearch_id").getValue()    
});
dsMaterialOutsourcingList.load({params : {start : 0,limit : 30}});

作者: asp_c   发布时间: 2011-09-21

自己顶了

作者: asp_c   发布时间: 2011-09-21

怎么没有人帮帮忙啊

作者: asp_c   发布时间: 2011-09-21

快救救我啊

作者: asp_c   发布时间: 2011-09-21