View Full Version : displaying Ext.data.Records in Ext.ListView

4 Nov 2009, 9:26 AM
I'm trying to display some Ext.data.Records in an Ext.ListView.

The records are a "subclass" of Ext.data.Record which have a "getDescription()" function added.

I would like to use this method to "render" the records, but I can't figure out how to do this.

Here's my Ext.ListView declaration:

var criteriaListPanel = new Ext.ListView({
store: myRecordStore,
columns: [
header: 'Record',
dataIndex: 'myRecordId',
tpl: ????????

Can anyone tell me what to put in the tpl config so my getDescription() function will get called?

Or is there a different way to go about this?


- Michael

4 Nov 2009, 11:45 AM
You don't.

You create a Field in a normal Record (as created by Ext.data.Record.create) called "description".

4 Nov 2009, 11:51 AM
Thanks, Animal! But is there any way for that field to be a function instead of just a value? If not I suppose I could set the description after creating each record, but that seems a bit less elegant.

4 Nov 2009, 11:56 AM
A Field's value can be calculated from any values in the source data object by using a convert function to create the value.