当前位置:编程学习 > JS >>

extjs对关联关系的处理

extjs对关联关系的处理采用了model层使用mapping来关联相应的实体属性
Ext.define('Business.model.businessRequest.BrUnitRuleModel', {
extend : 'Ext.data.Model',
fields : [ 'id', 'code', 'description','typeName','type',{name:'typecode',mapping:'brUnitRuletype.code'}],
// belongsTo: 'Business.model.businessRequest.BrUnitRuleTypeModel',
idProperty : 'id'
});
在grid的中可以用typecode显示,
mapping是对应的规则的属性下的一个实体brUnitRuleType的code,采用这种方式可以关联实体,
extjs4.0后model的功能增强,有一对多,多对一,和多对多的关系,可能会有更好的解决方案,知道的可以回复我,谢谢了,

exjts对要显示数据的处理:

{
header : '审批状态',
dataIndex : 'approvalStatus',
renderer:function(value){
   if(value=='0'){
       return '未审批';
   }
   if(value=='1'){
       return '已审批';
   }
}
}


作者:woshiyjk
补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,