1. #1
    Sencha User tf.alves's Avatar
    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    54
    Vote Rating
    0
    tf.alves is on a distinguished road

      0  

    Default xtemplate member functions in Sencha Designer

    xtemplate member functions in Sencha Designer


    Hello all,

    How can I create a member function to use with an xtemplate?
    I'm defining this xtemplate directly in a list. I tried using scope:this, but it doesn't work, I guess this is because the xtemplate is being implemented directly in the base class... All I really need is to be able to define a member function to use in the xtemplate.

    P.s. I'm using Sencha Touch.

    Thanks.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,092
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    It's not currently possible. What i would recommend as a workaround would be to add a function to the standard set of Ext.util.Format functions and then invoke that method.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User tf.alves's Avatar
    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    54
    Vote Rating
    0
    tf.alves is on a distinguished road

      0  

    Default


    I see. Where should I do that then? In the Application launch method?

    Thanks

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,092
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Ya, that's where I'd do it
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User tf.alves's Avatar
    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    54
    Vote Rating
    0
    tf.alves is on a distinguished road

      0  

    Default


    Thanks!

  6. #6
    Sencha User tf.alves's Avatar
    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    54
    Vote Rating
    0
    tf.alves is on a distinguished road

      0  

    Default


    Another idea... Is it possible to define the xtemplate by hand and then apply it to the list? That would solve the formatting function problem, or am I missing something?

  7. #7
    Sencha User
    Join Date
    May 2012
    Posts
    35
    Vote Rating
    1
    confile is on a distinguished road

      0  

    Default


    I have the same problem any suggestions?

  8. #8
    Ext JS Premium Member
    Join Date
    May 2011
    Posts
    38
    Vote Rating
    0
    reproman is on a distinguished road

      0  

    Default


    Aaron,

    I have a similar situation. I have a View defined with tpl that renders some text and then two hyperlinks (Edit and Delete) for each row of data. When either of the two hyperlinks are clicked, I would like to fire one of my custom events for that View control. Can you please provide some sample code of how this can be accomplished using your suggested workaround? I have my onclick handlers in place to catch the hyperlink clicks, but am not sure how to structure the other part.

    Thanks!

  9. #9
    Sencha User
    Join Date
    Sep 2010
    Posts
    27
    Vote Rating
    2
    dusoft is on a distinguished road

      0  

    Default Does Sencha Architect(2.2.2) support xtemplate member functions?

    Does Sencha Architect(2.2.2) support xtemplate member functions?


    Hello..

    I am using sencha archiect 2.2.2 and the latest version of sencha touch 2.2.X.
    Can I define xtemplate merber function to format text or other purpose..?
    I created a Xtemplate member function with the "+" button in the Property window, but it's doesn't works.

    Please, can I help me?

    View

    Code:
    Ext.define('SuperPromo.view.promocion.List', {
        extend: 'Ext.dataview.List',
        alias: 'widget.promocionlist',
    
    
        config: {
            id: 'promocionList',
            emptyText: 'Loading promociones...',
            store: 'Promociones',
            itemTpl: Ext.create('Ext.XTemplate', 
                '<div class="some-class">',
                '            <span>{[this.toUpper(values.TextField)]}%</span>',
                '</div>',
                {
                    toUpper: function(text) {
                         return "SOMETEXT";
    
                    },
                    disableFormats: true
                }
            )
        }
    
    
    });

    Thanks!