EXTドロップダウンツリー(tree)リスト

3451 ワード

最終的に取得するのは部門のID番号です.方法:ドロップダウンボックスをクリックするとイベントがトリガーされ、ツリーディレクトリが展開され、部門をクリックすると取得した値が対応するフォーム項目//新規ユーザードロップダウンリストに割り当てられます.var user_combobox = new Ext.form.ComboBox({     store:            new Ext.data.SimpleStore({fields:[],data:[[]]}),     id:                'person_combobox',    //hiddenName:        'parent_group',readOnly:true,editable:false,//手書きおよび連想禁止機能fieldLabel:'所属部門',emptyText:'部門を選択してください',blankText:'ユーザーの所属部門を選択してください',allowBlank:false,validateOnBlue:true,     mode:             'local',     triggerAction:    'all',     anchor:            '90%',     tpl:             '
',     resizable:        true }); //ドロップダウンリストツリー構造var user_tree = new Ext.tree.TreePanel({     border:false,     autoScroll:true,     animate:true,     autoWidth:true,     autoHeight:true,     enableDD:false,     containerScroll: true,     loader: new Ext.tree.TreeLoader({         dataUrl:'tree/modules/combobox.php'                 }) }); //ツリーのクリックイベントuser_tree.on(「click」,function(node,e){Ext.get('parent_id').dom.value=node.id;//非表示フォーム項目user_combobobox.setValue(node.text);//option値user_combobox.collapse()//optionリストを非表示);var user_root = new Ext.tree.AsyncTreeNode({text:'セキュリティソフトウェア会社',//ノード名draggable:false,icon:'images/icon/org.gif',//ドラッグid:'asindata'//ノードid})user_tree.setRootNode(user_root);//optionを展開するとツリーuser_が生成されますcombobox.on('expand',function(){user_tree.render('user_group_tree');user_tree.expandAll();//自動展開ツリー});tree/modules/combobox.phpの結果は次のとおりです.
[{'id' : '134','text' : '134-right','parent_id' : '1','description' : '111111','str_type' : 'dept','icon'
 : 'images/icon/depart.gif','children':[]}
,{'id' : '135','text' : '135-offline','parent_id' : '1','description'
 : '111111','str_type' : 'dept','icon' : 'images/icon/depart.gif','children':[]}
,{'id' : '136','text'
 : '136','parent_id' : '1','description' : 'asindata','str_type' : 'dept','icon' : 'images/icon/depart
.gif','children':[]}
,{'id' : '138','text' : '138','parent_id' : '1','description' : '','str_type' : 'dept'
,'icon' : 'images/icon/depart.gif','children':[]}
,{'id' : '139','text' : 'asindata','parent_id' : '1'
,'description' : 'asindata','str_type' : 'dept','icon' : 'images/icon/depart.gif','children':[]}
]