mardi 24 juin 2014

How to catch a widgetcolumn's data change event?

Hi.

I have a Grid with a widgetcolumn. This is the widget of the widgetcolumn:



Code:



Ext.define('TestPortal.view.portal.testlist.TestItem', {
//extend: 'Ext.panel.Panel',
extend: 'Ext.container.Container',

xtype: 'app-testitem',

controller: 'testitem',
viewModel: {
type: 'testitem'
},

layout: {
type: 'vbox',
align: 'stretch',
pack: 'start'
},

//just to prevent a error
defaultBindProperty: 'recordId',

config: {
recordId: '',
setRecordId: function(value){
this.refresh(false);
}
},

height: 60,
flex: 1,

listeners: {
boxready: function(){
var me = this;
me.refresh(true);
}
},

refresh: function(noDelay){
var me = this;
var task = new Ext.util.DelayedTask(function(){
var dataModel = me.getWidgetRecord();
var viewModel = me.getViewModel();
viewModel.setData({
record: dataModel
});
});
if(noDelay){
task.delay(1);
}else{
task.delay(1000);
}
},

items: [
{
xtype: 'label',
bind: '{record.name}'
},{
xtype: 'label',
bind: '{record.info}'
},{
xtype: 'label',
bind: 'Ok: {successed}'
}
]
});

The Problem is: I need to set the viewmodels data manually after reloading the grid's store. I trie'd to overwrite the defaultBindProperty's setter Method to catch a data change. But at this time the widgetrecord is still null.

Is there a way to catch a data changed in widgetcolumn or the widget itshelf? Or is there a way to access the widgets via the grid?





Aucun commentaire:

Enregistrer un commentaire