1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    3
    Vote Rating
    0
    Yo074 is on a distinguished road

      0  

    Default Unanswered: XML TreeStore multilevel issue

    Unanswered: XML TreeStore multilevel issue


    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?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    That's because of your record config in your reader, it will get all category nodes not just the one level.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    3
    Vote Rating
    0
    Yo074 is on a distinguished road

      0  

    Default


    Hi mitchellsimoens and thanks for your answer.

    Removing the 'record' element from the treestore reader cause the following error :

    [ERROR][Ext.data.reader.Reader#readRecords] Record is a required parameter

    Any thoughts?

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Posts
    3
    Vote Rating
    0
    Yo074 is on a distinguished road

      0  

    Default


    Hi,

    I kept searching but not found any solution.
    Anyone has a clue?

    Thanks,

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi