Extjs3.0 checkboxGroup 動態添加item實現思路

來源:互聯網
上載者:User

Extjs3.0 中的CheckboxGroup預設不能動態添加item。雖然它繼承了Ext.form.Field,但是卻類似於容器。
CheckboxGroup配置中的items處理產生一個對應的panel,該處理過程只有一次,所以很難對CheckboxGroup進行動態添加。

如需要資料動態建立,試著建立整個CheckboxGroup,而不是動態添加item。
複製代碼 代碼如下:
var unitColumns=[];
for(var i = 0;i < records.length;i++){
unitColumns.push({
boxLabel: records[i].data.A11,
name: records[i].data.A11,
inputValue: records[i].data.A1,
checked: false
});
}
var itemsGroup = new Ext.form.CheckboxGroup({
id:'unitItems',
bodyStyle:'background-color: transparent;margin-top:10px;',
fieldLabel: '選項',
columns: 2,
items: unitColumns
});
Ext.getCmp('OptionsSet').add(itemsGroup);
Ext.getCmp('OptionsSet').doLayout();

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.