-
6 Feb 2012 7:03 AM #1
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:
Controller: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 > 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>' } ] },
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? [...]
-
6 Feb 2012 8:21 AM #2
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
-
6 Feb 2012 9:12 AM #3
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
-
6 Feb 2012 9:22 AM #4
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

-
6 Feb 2012 9:29 AM #5
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
-
6 Feb 2012 11:27 AM #6
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 Feb 2012 1:02 AM #7
Well rolled back to PR4 and everything's ship-shape again. Has tpl support for panels been removed from Beta or something?


Reply With Quote