View Full Version : Calling a function from Ext.xTemplate

17 Dec 2010, 8:22 PM
I have the problem in using this code:

var abc = new Ext.xTemplate (
'<b>Name: </b> : {name}',
'</br><b>City: </b> : {city}',
'</br><a onclick="abc('{name}')">View Address</a> '
abc: function(name)

ques: My requirement is to call a function abc, but giving error like 'Object Expected'; I tried to define this function in between <head> </head>, but not working. How to use this

18 Dec 2010, 12:27 AM
your code is not clear and it has no valid syntax. If you write a clearer (and working) example I may try to give you a help. Please use CODE tag (the # in post formatting toolbar) when putting code examples.

18 Dec 2010, 1:17 AM
You do not use inline event handlers in modern web apps.

Add a click listener to your main element and use the delegate option to select the target element type.

But that is not your code. There's no such class as "xTemplate"

18 Dec 2010, 1:53 PM
djn, don't use a Javascript framework if you're not comfortable with Javascript itself.