-
7 Dec 2011 3:25 PM #1
Dataview itemtpl vs tpl
Dataview itemtpl vs tpl
Apparently tpl is no longer functioning in Dataviews the way they used to be (ie accessing the configured store), and we now must use itemTpl and forego the 'itemSelector' configuration to tell us what triggers an item select.
So - the question is ... how do I achieve the same looping mechanism in a dataview now ?
I have data which I have to wrap in a table structure, and have each item as a cell in that table.
This no longer works as far as I can tell. In fact - it seems rather silly that itemTpl can take a XTemplate which understands the <tpl for="."> mechanism since the Template is only performed on the single record.
Suggestions ?
Thank you!
Kevin
The above is what I need to get working again. It doesn't. Switching to itemTpl does - but of course, creates a table for each item. :-(Code:tpl: new Ext.XTemplate( '<table border=0>', '<tr>', '<tpl for=".">', '<td>{random data from record here}</td>', '</tpl>', '</tr>', '</table>' )
-
8 Dec 2011 5:35 PM #2
Hi. I'm not sure about the answer, although I've been asking myself the same question, but have you tried extending DataView instead of passing "tpl" as a configuration parameters?
Wonder if that worksCode:Ext.define('MyDataView', { extend: 'Ext.DataView', config: { tpl: new Ext.XTemplate(...) } });
-
8 Dec 2011 5:46 PM #3
This looks like a bug. I'll add it as a ticket. Thanks.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
10 Dec 2011 6:51 AM #4
Same here, please provide this functionality back! Thanks!
-
13 Jan 2012 4:09 PM #5
So it seems this will not back it back into 2.0. This is because of the new structure of DataView and ComponentView, and all the complex dom structure that follows it.
If you wish to do this manually, you will need to override getElementConfig in your subclass of DataView. The default is the following:
Here you can add any extra parent element you wish to add. Be aware though that this will not be direct parents of each item.Code:getElementConfig: function() { return { reference: 'element', className: 'x-container', children: [{ reference: 'innerElement', className: 'x-inner' }] }; }Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
15 May 2012 11:03 PM #6
how to add a parent element for the items? can you take an example? thank you very much
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-1206
in
2.0.


Reply With Quote