-
12 Mar 2012 10:24 AM #1
Templating Ext.field.Field
Templating Ext.field.Field
I'd like to implement custom field, and specified tpl property on it, but I noted that Ext.AbstractComponent is looking for renderTemplate. So what should I use? (i've tried both actually and got different errors there)
My recent commitment into Sencha community:
Star Rating Field: https://github.com/podlipensky/Ext.ux.touch.Rating
Sencha Articles on my blog: http://podlipensky.com
-
12 Mar 2012 10:45 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Ext.field.Field uses the getElementConfig method route where it returns an object of element structure to create.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Mar 2012 10:58 AM #3
In other words, there is no ability to customize field's template, right?
My recent commitment into Sencha community:
Star Rating Field: https://github.com/podlipensky/Ext.ux.touch.Rating
Sencha Articles on my blog: http://podlipensky.com
-
12 Mar 2012 11:01 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Sure there is. Override this method to add or remove what you need.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Mar 2012 11:12 AM #5
Mmm, I feel myself not comfortable when I need to override method of one of the base classes.
Anyway, what kind of config should I return, I've tried this one:
I've tried such approach:
But it simply makes tpl and data as custom properties on field's dom element. What kind of config it is? Is it different from what we had in Sencha 1.x?Code:getElementConfig: function() { var prefix = Ext.baseCSSPrefix; return { reference: 'element', className: 'x-container', children: [ { reference: 'label', cls: prefix + 'form-label', children: [{ reference: 'labelspan', tag: 'span' }] }, { reference: 'renderTemplate', tag: 'div', tpl: this.tpl, data: this.renderData, cls: prefix + 'component-outer' } ] }; },
But it makes tpl and data as custom properties on dom element. So, what kind of config it is?My recent commitment into Sencha community:
Star Rating Field: https://github.com/podlipensky/Ext.ux.touch.Rating
Sencha Articles on my blog: http://podlipensky.com
-
12 Mar 2012 11:17 AM #6
...and what type of object renderTemplate should be? It has cloneNode method, but Ext.XTemplate class doesn't have such object? Thanks.
My recent commitment into Sencha community:
Star Rating Field: https://github.com/podlipensky/Ext.ux.touch.Rating
Sencha Articles on my blog: http://podlipensky.com
-
27 Mar 2012 8:16 AM #7
Did you have any luck on this? I'm having the same problem myself converting a 1.1 custom field to 2.0.
http://www.sencha.com/forum/showthre...rom-1.1-to-2.0


Reply With Quote