PDA

View Full Version : Ext.XTemplate



crazy
9 Oct 2009, 9:35 PM
hi everyone,

in my data store, i give the template as shown below.
i want to pass the {name} as arguments to the function. but here that braces {} show some errors.
how can i give that name as arguments.



tpl: new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="{name}">',
'<div class="thumb"><img src="{url}" title="{name}"></br><b>{name}</b></br></div>',
'<div><a href="#" onclick=javascript:deletePerson({name});>Delete</a></div>',
'</div>',
'</tpl>',
'<div class="x-clear"></div>'
),


any help ................


thanks
cRaZy

Animal
9 Oct 2009, 11:57 PM
Do not do that.

This has been covered many times.

Give the clickable element a class.

Then add a click listener to the DataView's element using the delegate option

Animal
9 Oct 2009, 11:58 PM
Or use the DataView's click event and interrogate the event yourself to see whether it is within your clickable element.

crazy
16 Oct 2009, 2:47 AM
hi all,

in my dataview, i gave fields like this.



fields: ['index','name', 'url']


is there any way to get this {name} to another variable........

thanks in advance......
cRaZy

Animal
16 Oct 2009, 2:55 AM
Do you mean find out which Record you clicked on?

crazy
16 Oct 2009, 3:02 AM
ya

crazy
16 Oct 2009, 3:11 AM
hi animal,

i am trying to show an image containing some random text for the user authentication.
i also need to check the user's entry with the text(which is the {name} itself).
how should i get the {name} for checking....

thanks...
cRaZy

Animal
16 Oct 2009, 3:53 AM
http://www.extjs.com/deploy/ext-3.0.0/docs/?class=Ext.DataView&member=click