Hello everybody! Please can you help me: I have a tree in which empty childNodes are expanded, but I need them not to expand. Thanks!



It is my app



Ext.application({
name: 'WMS Panel',
launch: function () {

var store = new MyApp.store.Store();

var tree = Ext.create('MyApp.tree.Tree', {
title: 'Tree',
store: store,
renderTo: Ext.getBody(),
});

}
});



It is my reader



Ext.define('MyApp.reader.Reader', {
extend: 'Ext.data.reader.Json',

alias: 'reader.reader',

getResponseData: function(response) {
var data = response.responseXML;
if(!data || !data.documentElement) {
data = response.responseText;
}

var layers = data.getElementsByTagName('Layer');

var layer = layers[0];

var title = layer.getElementsByTagName('Title')[0].childNodes[0].nodeValue;
var name = undefined;

var rootLayer = {
Title: title,
Name: name,
children: []
};

for (var i = 1; i < layers.length; i++) {
layer = layers[i];

title = layer.getElementsByTagName('Title')[0].childNodes[0].nodeValue;
name = layer.getElementsByTagName('Name')[0].childNodes[0].nodeValue;

rootLayer.children.push({
Title: title,
Name: name
});
}

return [rootLayer];
}
});



It is my store



Ext.define('MyApp.store.Store', {
extend: 'Ext.data.TreeStore',

requires: [
'MyApp.reader.Reader'
],

autoLoad: true,

proxy: {
type: 'rest',
appendId: false,
url: 'data/ahocevar.xml',
reader: {
type: 'reader'
}
}
});



It is my tree



Ext.define('MyApp.tree.Tree', {
extend: 'Ext.tree.Panel',

useArrows: true,
rootVisible: false,

width: 300,
height: 800,

columns: [{
xtype: 'treecolumn',
text: 'Layer',
dataIndex: 'Title',
flex: 1,
sortable: true,

}],
});



It is ahocevar.xml



<Layer>
<Title>GeoServer Web Map Service</Title>
<Layer>
<Name>ne:ne</Name>
<Title>Natural Earth Base Map</Title>
</Layer>
<Layer queryable="1">
<Name>ne:NE1_HR_LC_SR_W_DR</Name>
<Title>NE1_HR_LC_SR_W_DR</Title>
</Layer>
<Layer queryable="1">
<Name>opengeo:countries</Name>
<Title>Countries of the World</Title>
</Layer>
</Layer>


UPDATE: I added to the reader "leaf: true" and now everything works



rootLayer.children.push({
Title: title,
Name: name,
Abstract: abstract,
leaf: true
});