| Код | <html> <head> <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css"/> <script type="text/javascript" src="ext-base.js"></script> <script type="text/javascript" src="ext-all.js"></script> </head> <body> <div id="panel"></div> <script> Ext.onReady(function(){ var auto_tree = new Ext.tree.TreePanel({ el : 'panel', autoScroll:true, loader: new Ext.tree.TreeLoader({ dataUrl:'ff.php' }), containerScroll: true, border: false, baseCls: "tree-road", height: 300, width: 232, rootVisible:false, root: new Ext.tree.AsyncTreeNode({id: 'id_mach'}), listeners: { click: function(n) { if (!n.isLeaf()) { Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.text + '"'); } } } }); auto_tree.render(); auto_tree.getRootNode().expand(); }); </script> </body> </html>
|
Файл ff.php возвращает данные оттого какая ветка должна быть раскрыта
| Код | <? if ($_POST['node'] == 'id_mach'){ echo "[{text:'АВМ', id:'384', id_mach:'384', leaf:true, cls : 'folder' },{text:'АВСЭ', id:'174', id_mach:'174', leaf:false, cls : 'folder' }]"; } else if ($_POST['node'] == '174'){ echo "[{text:'chield', id:'384', id_mach:'175', leaf:true, cls : 'folder' }]"; } die(); ?>
|
|