Hello,
I'm quite new to Sencha Touch and after few hours of searching, I decided to ask for help!
I'm currently facing the following issue:
let's consider the following XML file (categories.xml) :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<categories>
<category>
<name>Cat1</name>
<category>
<name>SubCat1-1</name>
<category>
<name>SubSubCat1-1</name>
</category>
</category>
<category>
<name>SubCat1-2</name>
</category>
</category>
<category>
<name>Cat2</name>
<category>
<name>SubCat2-1</name>
<category>
<name>SubSubCat2-1</name>
</category>
</category>
<category>
<name>SubCat2-2</name>
</category>
</category>
</categories>
Here is my model :
Code:
Ext.define('touchme.model.Category', { extend: 'Ext.data.Model',
config: {
fields: ['name'],
associations: [{
type: 'hasMany',
model: 'touchme.model.Category',
name:'categories',
associationKey: 'categories',
reader: {
type: 'xml',
rootProperty: 'categories'
}
}]
}
});
And here is the store :
Code:
Ext.define('touchme.store.Categories', { extend : 'Ext.data.TreeStore',
require: 'touchme.model.Category',
config : {
model : 'touchme.model.Category',
storeId : 'categoriesStore',
nodeParam : 'category',
proxy : {
type : 'ajax',
url : 'categories.xml',
reader : {
type : 'xml',
rootProperty: 'categories',
record: 'category'
}
},
autoLoad: true
}
});
I then created a nestedList view :
Code:
Ext.define('touchme.view.TestNestedList', { extend : 'Ext.dataview.NestedList',
alias : 'widget.nestedList',
title : 'Test Categories',
config : {
store : 'categoriesStore',
itemTpl: ['<div>{name}</div>']
}
});
Problem is, the nested list is not showing correctly,
Instead of having :
Code:
Cat1
|->SubCat1-1
| |->SubSubCat1-1
|->SubCat1-2
Cat2
|->SubCat2-1
| |->SubSubCat2-1
|->SubCat2-2
I have the following:
Code:
Cat1
SubCat1-1
SubSubCat1-1
SubCat1-2
Cat2
SubCat2-1
SubSubCat2-1
SubCat2-2
As anyone already faced this issue?