日期:2014-05-16  浏览次数:20318 次

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 '已审批';
   }
}
}