mardi 30 décembre 2014

Populating Dataview with different dataitems

Hi guys,

i need assistence. I try to simplify my code but the dataview with component use is a showstopper fpr me.


The dataview with components works fine for me, but i have different dataitem types. So each type has different controls. I would like to change the dataitem class in relation to the type i get from the record.

I tried to change the apply method:



Code:



applyDeviceOverviewBox: function(config) {
if (this.getRecord().get('unique_name') == 'type1') {
return Ext.factory(config, HomeBox.view.type1.DeviceInnerItemView, this.getDeviceOverviewBox());
} else if (this.getRecord().get('unique_name') == 'type2') {
return Ext.factory(config, HomeBox.view.type2.DeviceInnerItemView, this.getDeviceOverviewBox());
}
},

But as soon as i use "this.getRecord()" in applyDeviceOverviewBox method the containing apply methods from datamap are not be called.

DataMap:



Code:



getDeviceOverviewBox: {
setDeviceIcon: 'homebox_type',
setDeviceControlElement1: 'homebox_type',
setDeviceControlElement2: 'homebox_type',
setDeviceId: 'unique_name'
},

Any idea?



Populating Dataview with different dataitems

Aucun commentaire:

Enregistrer un commentaire