PDA

View Full Version : Loading Nested XML into TreeStore



siggi
12 Apr 2013, 2:21 AM
Hello, everyone,

I have serious trouble loading a nested xml into a tree store.

XML:


<?xml version="1.0" encoding="iso-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body>
<ns1:getUserModulesResponse xmlns:ns1="urn:sunny">
<return xsi:type="xsd:string">
<nodes>
<node>
<id>COMPONENTTEST</id>
<text>!!!TEST!!!</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>desktop</id>
<text>Desktop</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<text>Buchungen</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>0</leaf>
<nodes>
<node>
<id>tree_item_buchungen_neu</id>
<text>Neue Buchung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>tree_item_buchungen_suche</id>
<text>Buchungsliste</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</node>
<node>
<text>Produkte</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>0</leaf>
<nodes>
<node>
<id>tree_item_linienfluege</id>
<text>Linienflüge</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</node>
<node>
<text>Statistik und Monitoring</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>0</leaf>
<nodes>
<node>
<id>tree_item_statistik_agenturen</id>
<text>Agenturstatistik</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</node>
<node>
<text>Buchhaltung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>0</leaf>
<nodes>
<node>
<id>tree_item_buchhaltung_kontoart</id>
<text>Kontoart</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>tree_item_buchhaltung_kontogruppe</id>
<text>Kontogruppe</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>tree_item_buchhaltung_kontotexte</id>
<text>Kontotexte</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</node>
<node>
<text>Verwaltung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>0</leaf>
<nodes>
<node>
<id>tree_item_ku_verwaltung</id>
<text>Kundenverwaltung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>tree_item_ag_verwaltung</id>
<text>Agenturverwaltung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<id>tree_item_lf_verwaltung</id>
<text>Lieferantenverwaltung</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</node>
<node>
<text>Stammdaten</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
<node>
<text>Systemeinstellungen</text>
<icon>/images/sunny_logo_single_small.png</icon>
<leaf>1</leaf>
</node>
</nodes>
</return>
</ns1:getUserModulesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Store config:


/* * To change this template, choose Tools | Templates
* and open the template in the editor.
*/


Ext.define('Sunny.store.TreeModules', {
extend: 'Ext.data.TreeStore',
root: {
expanded: true
},
proxy: {
type: 'memory',
data: //THE XML STRING//,
reader: {
type: 'xml',
record: '>node',
root: "nodes",
propertyId: "text"
}
//type: 'ajax',
//url: 'json/tree-data-'+eSoft.helpers.cookieMatcher('sunny_lang')+'.json'
},
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}],
listeners: {
load: {
fn: function(store, node, records, successful, eOpts) {
console.log(node);
console.log(store)
}
}
}
});




The store does not get populated, os nothing is visible in the Tree.

What exactly am I doing wrong?

Thank you in advance for your help,

Siggi

siggi
12 Apr 2013, 3:06 AM
Disregard that, had the wrong xml format.

This can be closed :)