PDA

View Full Version : Ext.XTemplate && Store && "external" variables



Ex_Soft
3 Jun 2011, 3:45 AM
function SmthFunc(id, name)
{
var
store = new Ext.data.JsonStore({
url: "SmthHandler.aspx",
root: "rows",
successProperty: "success",
totalProperty: "total",
fields: [
{ name: "ID", type: "int" },
"IMAGE_NAME"
],
baseParams: {
id: id
}
}),
tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div><img src="Image.aspx?id={ID}&imagename={IMAGE_NAME}" title="{IMAGE_NAME}" onclick="ShowBigImg({G_ID},&quot;{IMAGE_NAME}&quot;,&quot;{name}&quot;)"></div>',
'</tpl>',
'<div class="x-clear"></div>'
);

How to use "external" variable name in Ext.XTemplate?

skirtle
3 Jun 2011, 5:45 PM
Like this maybe?


function SmthFunc(id, name)
{
var ...,
tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div><img src="Image.aspx?id={ID}&imagename={IMAGE_NAME}" title="{IMAGE_NAME}" onclick="ShowBigImg({G_ID},&quot;{IMAGE_NAME}&quot;,&quot;', name, '&quot;)"></div>',
'</tpl>',
'<div class="x-clear"></div>'
);