Ext 根據store動態獲取checkbox

(1)首先獲取checkbox的列表:
getBusinessStore: function(){
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({url: 'source.do?m=getBusinessList'}),
root : "businessList",
autoLoad : false,
fields : ['value', 'text'],
totalProperty : "totalRows"
});
store.load();

return store;

}

(2)是store on load之後拼接panel中的items中的checkbox:
var businesses="[";
var count = businessStore.getCount();

for(var i=0; i<count; i++){
businesses += "{boxLabel: '" +businessStore.getAt(i).get('text')+ "', inputValue: '"+i+"', id: '"+businessStore.getAt(i).get('value')+"'}";
if(i < count-1){
businesses = businesses + ",";
}
}
businesses +="]";
businesses = Ext.decode(businesses);
var businessPanel = new Ext.FormPanel({
border: false,
layout: 'form',
bodyStyle: 'padding-right:5px;padding-left:5px; padding-top:5px;',
defaultType: 'checkbox',
items: [{
xtype: 'fieldset',
title: '業務列表',
defaultType: 'checkbox',
items: businesses

}]
});
發佈了54 篇原創文章 · 獲贊 0 · 訪問量 3087
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章