PDA

View Full Version : tree and xml



fvinson
6 Sep 2012, 7:23 AM
I have this xml file : projects_v1.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<nodes>
<node>
<text>grid</text>
<cls>folder</cls>
<leaf></leaf>
<children>
<text>transform-dom_v7.html</text>
<description>Transformation d'une table ecrite avec balise html en table grid</description>
<src>grid/transform-dom_v7.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>grid-search_v1.html</text>
<description>Table avec fonction Search depuis données au format json</description>
<src>grid/grid-search_v1.html</src>
<cls>file</cls>

<leaf>true</leaf>
</children>
<children>
<text>grid-search-mysql_v1.html</text>
<description>Table avec fonction Search
depuis données générées par fichier php (le php execute requete sql
qui renvoi les data en format json</description>
<src>grid/transform-dom_v7.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
</node>
<node>
<text>layout</text>
<cls>folder</cls>
<leaf>false</leaf>
<children>
<text>MetExplore_visu_v5.html</text>
<description>LAyout MetExplore - Visualiation des Pathway/...../Gene des BioSOurce present dans la base</description>
<src>layout/MetExplore_visu_v5.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>MetExplore_visu_v7.html</text>
<description>LAyout MetExplore avec Panier Drag and Drop du grid Patnway vers gridPanier</description>
<src>layout/MetExplore_visu_v7.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>MetExplore_modif_v2.html</text>
<description>Modification des Reactions lors du save</description>
<src>layout/MetExplore_modif_v2.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>MetExplore_modif_v11.html</text>
<description>Affectations multiples / Delete / Commit des changement sur REACTIONS /Comment /Biblio</description>
<src>layout/MetExplore_modif_v11.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>MetExplore_modif_v10.html</text>
<description>Affectations multiples / Delete / Commit des changement sur REACTIONS</description>
<src>layout/MetExplore_modif_v10.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
</node>
<node>
<text>graph</text>
<cls>folder</cls>
<leaf></leaf>
<children>
<text>MetExplore_visu_v8.html</text>
<description>Panier + Graph</description>
<src>graph/MetExplore_visu_v8.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
<children>
<text>graph-jit_v1.html</text>
<description>graph</description>
<src>graph/graph-jit_v1.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
</node>
<node>
<text>ajax</text>
<cls>folder</cls>
<leaf></leaf>
<children>
<text>MetExplore_modif_v4.html</text>
<description>Save reactions : appel Ajax fichier php qui execute fichier jar / recupere le contenu du log et renvoi ajax du resultat</description>
<src>ajax/MetExplore_modif_v4.html</src>
<cls>file</cls>
<leaf>true</leaf>
</children>
</node>

</nodes>



I have this javascript



Ext.require([
'Ext.tree.*',
'Ext.data.*'
]);

Ext.onReady(function() {

var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'projects_v1.xml',
extraParams: {
isXml: true
},
reader: {
type: 'xml',
root: 'nodes',
record: 'node'
}
},
sorters: [{
// property: 'leaf',
// direction: 'ASC'
},{
property: 'text',
direction: 'ASC'
}],
root: {
text: 'Examples',
id: 'src'
//expanded: true
}
});

// create the Tree
var westPanel = Ext.create('Ext.tree.Panel', {
store: store,
region:'west',
hideHeaders: true,
rootVisible: true,
height: 350,
width: 400,
title: 'Listing',
//renderTo: 'tree-example',
collapsible: true
});

/**************************************************************************************************************
* create the Panel : dans center Panel mettre les differents grid dans tabPanel
**************************************************************************************************************/
var centerPanel = Ext.create('Ext.tab.Panel', {
region:'center',
split:true,
width: 610,
margins:'0 2 2 2',
layout:'accordion',
items: []
});
/**************************************************************************************************************
* Ensemble des Panels
*/
var viewport = Ext.create('Ext.Viewport', {
layout:'border',
items:[centerPanel, westPanel]
});


});

I want this :
grid
|_transform-dom_v7.html
|_grid-search_v1.html
|_grid-search-mysql_v1.html
layout
|_MetExplore_visu_v5.html
....


Thank you

mitchellsimoens
17 Sep 2012, 7:00 AM
What's the question?

fvinson
20 Sep 2012, 7:13 AM
the question :
I want this :
grid
|_transform-dom_v7.html
|_grid-search_v1.html
|_grid-search-mysql_v1.html
layout
|_MetExplore_visu_v5.html
....
and I have
grid
|_grid
|_layout
layout
and when i click on grid I have also grid / layout folder

Thank you