how could I shorten long names inside a list object in sencha touch when my template ist build like
itemTpl: '{firstName} {lastName}',
thnx!
EDIT: thanx for your tries, buddies! my problem is that I use
plugins: [new app.plugins.editableList()], // by WhiteFox AS
which seems to make the trouble. while without plugin the simple
{
xtype: 'list',
...
itemTpl: new Ext.XTemplate(
'<tpl for=".">',
'<div>{[this.shortenName(values)]}</div>',
'</tpl>',
{
shortenName: function(values) {
return values.firstName.substr(0, 5);
}
}
),
...}
seems to work.
You can embed the javascript in the template. If you have some function “truncate”, you can just do