View Full Version : problem with list display using json

manish khamar
25 Aug 2011, 11:53 PM

I have one complex problem.

I parse json using ajax request and get response properly.
then show it in list as below:

method: 'post',
success: function(response){
recdata = Ext.decode(response.responseText);
Ext.regModel('User', { fields: ['address']
var c = new Ext.data.Store({
model: 'User',
autoLoad: true,
data: [recdata],
var myTpl = new Ext.XTemplate(
'<tpl for="."><div class="user"><div>{address}</div><div class="pic"><img src="{[values.picture[0].url]}" ></div></div></tpl>'

var list = new Ext.List({ fullscreen: true,
itemTpl :myTpl,
store : c
I can list all data properly from json means address and image both.

But now problem is that in my json some url tag do not consist any image string so i can not display that image.So I want to display some defualt image there.But i have no idea how i can do that.
so pls help me to solv it.:(

26 Aug 2011, 10:44 PM
Please use CODE tags when posting.

Please do not double-post (http://www.sencha.com/forum/showthread.php?145149-problem-with-display-default-image-in-list).