PDA

View Full Version : [FIXED] prepareData not working in List?



basememara
4 Dec 2011, 4:39 AM
Both variables show up blank in the template. In regular Ext JS 4, this works perfectly. Is there a new way to do this in Touch 2 or is this a bug?


{ xtype: 'list',
store: 'SomeStore',
itemTpl: [
'<div>{shortTitle}</div>', '<div>{sometest}</div>'
],
prepareData: function(data) {
Ext.apply(data, {
shortTitle: Ext.util.Format.ellipsis(data.name, 7), sometest: 'Test'
});
return data;
}
}

rdougan
4 Dec 2011, 12:31 PM
This is a bug. I've added it to our bug tracker.

Jamie Avins
12 Jan 2012, 10:17 AM
This has been fixed for the next release.

chuckoh
19 Jan 2012, 1:11 AM
when do you think you guys'll release the prepareData bug fixed version? any rough ideas?

Jamie Avins
19 Jan 2012, 9:05 AM
I can't give any dates as of yet, should be soon though.

neilios
8 Jul 2012, 9:59 PM
I'm using version 2.0.1.1 and am running into this problem using an Ext.dataview.List instance, where prepareData is not being called at all.

Is the fix in some other version or have I found something else?



var cfg = {
extend:'Ext.dataview.List';
config: {
store: myStore;
itemTpl: [
'<tpl for=".">',
'<div class="requests-wrap x-data-item" id="request-{ID}">',
'{title}',
'<span>{summary}</span>',
'<span>{subject}</span>',
'</div>',
'</tpl>',
'<div class="x-clear"></div>'
].join(''),

prepareData: function(data, recordIndex, record) {
// Never called
Ext.apply(data, {
title: "My Title,
summary: "My Summary"
});
return data;
},
}
}
Ext.define('myName', cfg);





Thanks,
Neil

neilios
10 Jul 2012, 11:49 PM
Did anyone that had this problem earlier get a fix in a later release?
Is there a workaround?

Thanks,
Neil

Ballsacian1
5 Oct 2012, 11:26 AM
RC1 doesn't use the data from prepareData to actually populate the itemTpl. prepareData gets called by the DataItem class but then the ListItem call ListItem.getBody().setRecord(record) which is what results in rendering of the itemTpl the ListItem.getBody() does not have the prepareData but only a getData(true).

TommyMaintz
19 Oct 2012, 7:03 AM
This has been fixed for the next release. Thanks for the report.

gigel
20 Mar 2013, 9:52 AM
And which release is that? You posted in October 2012. This is March 2013, using Sencha Touch 2.1.1 and the function still does not get called.

raskri
10 May 2013, 1:47 PM
And which release is that? You posted in October 2012. This is March 2013, using Sencha Touch 2.1.1 and the function still does not get called.

This is really not cool! ~o)