Srinivas B
13 Jul 2007, 5:30 AM
Hi all ,
when i am loading the jsonview using load function we need to pass the url as a argument to the load function.
But the issue is i am having the data with me ... there is no need to make ajax call to get the data.. I am trying to code this jsonview as below.
var tpl = new Ext.Template(
'<div class="thumb-wrap" id="{name}">' +
'<div class="thumb"><img src="{url}" class="thumb-img"></div>' +
'<span>{shortName}</span></div>'
);
// initialize the View
var previewJsonView= new Ext.JsonView(imgBody, tpl, {
jsonRoot: 'images',
multiSelect: false//,
//selectedClass: "x-view-selected"
});
previewJsonView.prepareData = function(data){
data.shortName = data.name.ellipse(15);
lookup[data.name] = data;
return data;
};
logDebug("json data : " + jsondata );
previewJsonView.render( previewJsonView.getEl(), jsondata );
previewJsonView.refresh();
The json data that i am passing as below...
{ "images":[{"isNew":[true],"url":["/users/5/thumbs/1/latest"],"name":[0]},{"isNew":[true],"url":["/users/5/thumbs/1/latest"],"name":[1]}]}
I am unable to render the JsonView in my page.. Any body help me how to do this... ..
Thanks in Advance,
Srinivas.
when i am loading the jsonview using load function we need to pass the url as a argument to the load function.
But the issue is i am having the data with me ... there is no need to make ajax call to get the data.. I am trying to code this jsonview as below.
var tpl = new Ext.Template(
'<div class="thumb-wrap" id="{name}">' +
'<div class="thumb"><img src="{url}" class="thumb-img"></div>' +
'<span>{shortName}</span></div>'
);
// initialize the View
var previewJsonView= new Ext.JsonView(imgBody, tpl, {
jsonRoot: 'images',
multiSelect: false//,
//selectedClass: "x-view-selected"
});
previewJsonView.prepareData = function(data){
data.shortName = data.name.ellipse(15);
lookup[data.name] = data;
return data;
};
logDebug("json data : " + jsondata );
previewJsonView.render( previewJsonView.getEl(), jsondata );
previewJsonView.refresh();
The json data that i am passing as below...
{ "images":[{"isNew":[true],"url":["/users/5/thumbs/1/latest"],"name":[0]},{"isNew":[true],"url":["/users/5/thumbs/1/latest"],"name":[1]}]}
I am unable to render the JsonView in my page.. Any body help me how to do this... ..
Thanks in Advance,
Srinivas.