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

asp_c 2011-09-21 03:34:42
数据模型

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'}
]
});


数据源
 
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组件

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,如下面代码

//数据源提取数据
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}});
...全文
569 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
uspcat 2011-10-21
  • 打赏
  • 举报
回复
对你绝对有帮助
http://www.uspcat.com/forum.php?mod=viewthread&tid=294

http://www.oschina.net/code/snippet_195396_6706
asp_c 2011-09-21
  • 打赏
  • 举报
回复
快救救我啊
asp_c 2011-09-21
  • 打赏
  • 举报
回复
怎么没有人帮帮忙啊
asp_c 2011-09-21
  • 打赏
  • 举报
回复
自己顶了

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧