1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    37
    Vote Rating
    0
    amaccann is on a distinguished road

      0  

    Default Unanswered: [BETA-1] SetData doesn't write data & render chosen Tpl

    Unanswered: [BETA-1] SetData doesn't write data & render chosen Tpl


    Hey,
    I am wondering if setData has changed at all, as calling setData on a tpl-powered panel no longer renders out the data passed in.

    However, I notice that calling getData() afterwards displays the same passed-in data no problem, in the same format. The parent object contains nothing within items when I called a console.log().

    Below is a chunk of the code that's dealing with these elements.

    View:
    Code:
    var myTpl = new Ext.XTemplate(
        '<div id="scroller" style="width:100%;">' +
             '<tpl for=".">' +
             '<div class="list-item bethistory-item" id="h{index}">' +
                 '<p class="name">{name} {handicap}</p>' +
                 '<tpl if="legs.length &gt; 1">' +
                     '<p class="more">plus {legs.length-1} more selection</p>' +
                 '</tpl>' +
                 '<tpl if="status == \'active\'">' +
                     '<p>Output {output}</p>' +
                 '</tpl>' +
                 '<tpl if="status == \'pending\'">' +
                     '<p>Potential Output {output}</p>' +
                 '</tpl>' +
             '</div>' +
             '</tpl>' +
         '</div>'
    );
    
    
    [...]
    {
        xtype: 'panel',
        id: 'historylist',
        scrollable: 'vertical',
        layout: 'vbox',
        items: [
            {
                xtype: 'panel',
                tpl: myTpl,
                id: 'historylistcontent',
                layout: 'fit',
                scrollable: false,
            },
            {
                xtype: 'panel',
                cls: 'loadmore-wrap',
                id: 'loadmorebutton',
                html: '<span class="black_square_button more_button" id="load-more">Load More</span>'
            }
        ]
    },
    Controller:
    Code:
    // Within the references of the Controller's config:
                historyListContent: {
                    selector: '#historylistcontent',
                },
    [...]
             listContent =    this.getHistoryListContent(),
    [...]
            console.log(data);                 // This outputs the data as an array of objects.
            listContent.setData(data);            // Call setData and push data into panel.
            console.log(listContent.getData());     // The same array objects as above
            console.log(listContent);             // Nothing within 'items', listContent is still empty?
    [...]
    

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    37
    Vote Rating
    0
    amaccann is on a distinguished road

      0  

    Default


    Just to clarify as well, the 'data' within the setData(data) call is simply an array of Objects, parsed from the the original getStore call to clean up some of the values' strings. As mentioned, the TPl seems to be reading (and storing, according to getData) these values, but not rendering the output.

    Any help appreciated as it's annoying spending more time trying to squash updated-related bugs than adding new features I'm supposed to be done

  3. #3
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Answers
    148
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Just a question:
    Why are you using a tpl and you set data array to your panel when you could simply use a List component?
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    37
    Vote Rating
    0
    amaccann is on a distinguished road

      0  

    Default


    The layout is custom & varies according to the data coming in. Some items have extra flags & notes within the list (if you see the Tpl, there's a few If statements in there). My understanding is that you can't customise list layouts in that fashion? Hence the user of Tpls, and cursing setData

  5. #5
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Answers
    148
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    You are wrong
    You can use that tpl even inside a List component.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  6. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    37
    Vote Rating
    0
    amaccann is on a distinguished road

      0  

    Default


    Would that be related though, as it seems my problem still comes back to the Tpl not rendering the data to the viewport after getting info from setData() rather than what kind of component I'm using it in. I had the same trouble elsewhere with setData to a tpl driven Panel component, so I dunno, it doesn't seem like that's the problem?

    It's fairly basic code that was working fine in PR4, so not sure why suddenly the same code should draw a blank in Beta?

    Any ideas?

  7. #7
    Sencha User
    Join Date
    Jan 2012
    Posts
    37
    Vote Rating
    0
    amaccann is on a distinguished road

      0  

    Default


    Well rolled back to PR4 and everything's ship-shape again. Has tpl support for panels been removed from Beta or something?

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar