这是我的代码,我想知道我的 for 循环限制(IE 8)如何在我的构造函数中有一个参数,所以我可以用特定的行数构建这个视图?然后,如何初始化这样的视图?
谢谢!
Ext.define('Prototype.view.FoodPanel', {
extend: 'Ext.Panel',
alias: 'widget.foodpanel',
config: {
height: 455,
id: 'FoodPanel',
layout: {
type: 'vbox'
},
scrollable: 'vertical',
items: [
{
xtype: 'panel',
height: 47,
id: 'rowTitle',
layout: {
type: 'hbox'
},
items: [
{
xtype: 'textfield',
id: 'column_title_source',
width: 100,
label: 'Source',
labelWidth: '100%',
readOnly: false
},
{
xtype: 'textfield',
id: 'column_title_user',
width: 100,
label: 'User',
labelWidth: '100%',
readOnly: true
},
{
xtype: 'textfield',
id: 'column_title_object',
width: 160,
label: 'Object',
labelWidth: '100%',
readOnly: true
},
{
xtype: 'textfield',
disabled: false,
id: 'column_title_factor',
width: 100,
label: 'Factor',
labelWidth: '100%',
readOnly: true
}
]
}
]
},
initialize: function() {
this.callParent();
var rows=[];
for(var i=0; i<8;i++)
{
var row = Ext.create(Prototype.view.RowModel);
if(i===4)
{
row.getComponent('mybutton').hide();
}
console.log(row.down('#rowLabel')._label);
rows.push(row);
}
this.add(rows);
}
});