Extjs 中的itemselector用法


先看下圖片,知道它是什么樣子的

一 加入itemselector控件

var isForm = new Ext.form.FormPanel({
items : [{
xtype : 'itemselector',
id:'itemselector',
anchor : '100%',
name : 'itemselector',
hideLabel : true,
style : 'margin-top:10px;margin-left:10px;margin-right:10px;',
imagePath : 'extjs/examples/ux/images/',
multiselects : [{
id:'left',
width : 162,
height : 240,
legend : "附加顯示字段:",
store :dsleft,
valueField : 'value',
displayField : 'text'
}, {
id:'right',
width : 162,
height : 230,
legend : "憑單縱向顯示字段:",
store:dsright,
valueField : 'value',
displayField : 'text',
tbar : [{
text : '清除',
handler : function() {
isForm.getForm().findField('itemselector')
.reset();
}
}]
}],
}]
});


二 獲取 右邊框設置的內容(注意是value值):

 

if(isForm.getForm().isValid()){
saveacct=isForm.getForm().findField('itemselector').getValue();
}

三 給向右添加的按鈕添加事件

 

isForm.getForm().findField('itemselector').addIcon.on('click',function(){
var i=isForm.getForm().findField('itemselector');
if(i.toMultiselect.view.store.getCount()>0){
addIcon(i);//相應的操作函數
}
}, this);

四 其他按鈕事件

this.toTopIcon.on('click', this.toTop, this);
this.upIcon.on('click', this.up, this);
this.downIcon.on('click', this.down, this);
this.toBottomIcon.on('click', this.toBottom, this);
this.addIcon.on('click', this.fromTo, this);
this.removeIcon.on('click', this.toFrom, this);

五 獲取左邊框內容(被選擇的內容)

 var selectionsArray = i.fromMultiselect.view.getSelectedIndexes();
if (selectionsArray.length > 0) {
record = i.fromMultiselect.view.store.getAt(selectionsArray[0]);
var value=record.get('value');
if(!selectEle(value)){ //判斷value值是否符合要求
Ext.MessageBox.show({
title: '提示',
msg: "該屬性不允許設置",
buttons: {yes:'確定'},
fn:function(buttonId){
if(buttonId == 'yes'){
dsleft.reload();
dsright.reload();
}
}
});

}
}

 



 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM