Results 1 to 7 of 7

Thread: Templating Ext.field.Field

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2008
    Location
    USA
    Posts
    61
    Vote Rating
    1
      0  

    Default 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

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Ext.field.Field uses the getElementConfig method route where it returns an object of element structure to create.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2008
    Location
    USA
    Posts
    61
    Vote Rating
    1
      0  

    Default

    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

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Sure there is. Override this method to add or remove what you need.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha Premium Member
    Join Date
    Aug 2008
    Location
    USA
    Posts
    61
    Vote Rating
    1
      0  

    Default

    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:
    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 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?

    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

  6. #6
    Sencha Premium Member
    Join Date
    Aug 2008
    Location
    USA
    Posts
    61
    Vote Rating
    1
      0  

    Default

    ...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

  7. #7
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    628
    Vote Rating
    40
      0  

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •