-
29 Mar 2012 7:58 AM #1
Defining and using functions in templates
Defining and using functions in templates
Hey guys,
I have this situation and I cannot get it to work.
I have a detail view opening from a list. Inside the detail view the entire data is built dynamically at itemtap.
In onListItemTap (main controller) I tried this:
detailView.getScheduleTemplate = function (str) {
return "***"+str+"***"; //just to see it working
}
in the template of the detailView I set this
{schedule:this.getScheduleTemplate}
schedule is set for the giving data, I also logged the detailView and IT DOES contain the new function getScheduleTemplate... so everything should be fine. I get this tho:
Uncaught Error: [ERROR][Ext.XTemplate#apply] Object [object Object] has no method 'getScheduleTemplate'
Ext.define.doWritesencha-touch-all-debug.js:26157
Ext.define.writesencha-touch-all-debug.js:18523
Ext.define.logsencha-touch-all-debug.js:18397
(anonymous function)sencha-touch-all-debug.js:18415
Ext.define.applyOutsencha-touch-all-debug.js:41061
Ext.define.applysencha-touch-all-debug.js:41042
Ext.define.overwritesencha-touch-all-debug.js:40766
Ext.define.updateDatasencha-touch-all-debug.js:54988
Ext.apply.generateSetter.settersencha-touch-all-debug.js:5227
(anonymous function)Main.js:114
(anonymous function)Main.js:134
Ext.apply.callbacksencha-touch-all-debug.js:9545
Ext.define.onProxyLoadsencha-touch-all-debug.js:49261
Ext.define.processResponsesencha-touch-all-debug.js:32372
(anonymous function)sencha-touch-all-debug.js:32792
Ext.apply.callbacksencha-touch-all-debug.js:9545
Ext.define.handleResponsesencha-touch-all-debug.js:15276
(anonymous function)sencha-touch-all-debug.js:3146
(anonymous function)
Please help!
-
29 Mar 2012 8:01 AM #2
The WYSIWYG editor malformated my error...
The WYSIWYG editor malformated my error...
Forget it.. :o)
Found a workaround, just used a global function and called it normally:
{[getScheduleTemplate(":o)")]}
-
29 Mar 2012 9:54 AM #3
You could also add it to Ext.util.Format
Aaron Conran
@aconran
Sencha Architect Development Team
-
29 Mar 2012 9:58 AM #4
COOLIO!
COOLIO!
Yeah this is what I was looking for
thanks!
Rudra


Reply With Quote