I have to set an image with text in a row of my List. But image is to be chosen at runtime.
Here is my Store:
Ext.define('MyApp.model.Sample', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'uName', mapping: '@name' },
{ name: 'uId', mapping: '@id' }
]
}
});
In my list itemTpl, I am able to display uName, and i have created a function(getImageURL) that is suppose to return the required image, so how shall i use or what is the way/syntax of using uId from the above ( which has a value of either 0 or 1)
And here is my list:
itemTpl : new Ext.XTemplate("<img src=\"{[this.getImageURL()]}\" width=\"20\" height=\"20\"></img><span> {uName}</span>",
{
getImageURL : function()
{
// I have to return either of two images
// if uId = 0, return 'resources/images/Image0.png'
// if uId = 1, return 'resources/images/Image1.png'
}
}
),