드롭다운 상자에 다중 선택 트리 표시
4892 단어 ExtJS 노트
기본 코드는 다음과 같습니다.
// --------------------------------
var calendar_department = new Ext.form.ComboBox({
id : 'calendar_department',
store : new Ext.data.SimpleStore({
fields : [],
data : [[]]
}),
editable : false,
mode : 'local',
triggerAction : 'all',
maxHeight: 200,
name : 'departments',
width : 340,
tpl : "
",
selectedClass : '',
fieldLabel : ' ',
layerHeight : 120,
onSelect : Ext.emptyFn
});
var tree = new Ext.tree.TreePanel({
animate : true,
border:false,
collapsible : true,
enableDD : true,
enableDrag : true,
rootVisible : false,
autoScroll : true,
width : 150,
lines : true
});
//
var root = new Ext.tree.AsyncTreeNode({
id : "root",
text : " ",
draggable:false, //
checked : false,
loader: new Ext.tree.TreeLoader({
dataUrl:'../getUserList.do'
})
});
tree.setRootNode(root);
tree.on('checkchange', function(node, checked){
node.expand();
node.attributes.checked = checked;
node.eachChild(function(child){
child.ui.toggleCheck(checked);
child.attributes.checked = checked;
child.fireEvent('checkchange', child, checked);
});
},tree);
tree.on('checkchange',function(){
var b = tree.getChecked();
var checkid = new Array;//
for (var i = 0; i < b.length; i++) {
checkid.push(b[i].text);//
}
calendar_department.setValue(checkid.toString());
}
);
calendar_department.on("expand", function() {
tree.render("tree");
});
var calendarSMSForm = new Ext.FormPanel({
id : 'calendarSMSForm_id',
title : '',
width : '100%',
height : '320',
layout : 'form',
// autoHeight:'true',
labelAlign : 'right',
frame : true,
labelWidth : 70,
items : [
calendar_department,{
xtype : 'textarea',
id : 'calendarSMSCustom_id',
fieldLabel : ' ',
name : 'smsCustom',
height : '90',
width : '90%'
}, {
xtype : 'textarea',
id : 'calendarSMScontent_id',
fieldLabel : ' ',
name : 'smscontent',
height : '100',
width : '90%',
allowBlank : false,
blankText : ' '
}, {
buttons : [{
text : ' ',
handler : function() {
calendarSMSWin.hide();
var f = calendarSMSForm;
if (f.form.isValid()) {
f.form.doAction('submit', {
// -----------
url : '../SMSAction.do',
method : 'post',
params : '',
success : function(form, action) {
// TODO ---625
Ext.Msg.alert(' ',
' ...!');
// business_store.load();
},
failure : function(form, action) {
win.show();
var obj = Ext.util.JSON
.decode(action.response.responseText);
Ext.Msg.alert(' ',
obj.errors);
}
})
}
}
}, {
text : ' ',
handler : function() {
var f = calendarSMSForm;
f.form.reset();
}
}]
}]
});
calendarSMSWin = new Ext.Window({ title: " " , width: 500 , height:
330 , buttonAlign:'center', layout: 'fit', plain:true,
resizable:false, frame : true, closeAction:'hide',
bodyStyle:'padding:5px;', items : calendarSMSForm
});