Obj config in initComponent
by molecule
HTML
<link rel="stylesheet" href="http://cdn.sencha.io/ext-4.2.0-gpl/resources/css/ext-all.css">
<script src="http://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js"></script>
JavaScript
Ext.require([
'Ext.form.*',
'Ext.tip.*'
]);
var store = Ext.create('Ext.data.Store', {
fields:['label'],
data:[]
});
Ext.define('AM.view.editpanel.CustomList', {
extend : 'Ext.container.Container',
alias : 'widget.sclist',
layout : {
type : 'vbox',
align : 'stretch'
},
flex : 1,
initComponent:function(){
this.items = [{
xtype : 'grid',
plugins:[],
selModel : {
selType : 'cellmodel'
},
tbar: [{
text:'Add',
actionId:'add',
handler: function(th, e, eArg) {
var store = th.up('grid').store;
var r = Ext.create(store.model.modelName
);
store.insert(0, r);
}
}],
height :200,
store:store,
columns: [
{ text: 'Name', dataIndex: 'label', flex: 1
, editor: {
xtype: 'numberfield',
allowBlank: false
}
},
{
xtype: 'actioncolumn',
width:30,
sortable: false,
actionId:'delete',
header:'delete',
items: [{
tooltip:'tool'
}]
}
],
flex : 1
}];
this.items[0].plugins.push(Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2
}));
this.callParent(arguments);
var sto = Ext.create('Ext.data.Store', {
fields:['label'],
data:[]
});
this.down('grid').bindStore(sto);
this.down('grid').columns[0].text='Name';
this.down('grid').columns[0].dataIndex='label';
}
});
Ext.onReady(function() {
Ext.QuickTips.init();
var grid1 = Ext.create('AM.view.editpanel.CustomList',{
renderTo: Ext.getBody()
});
var...