1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    200
    Answers
    11
    Vote Rating
    4
    dedoz is on a distinguished road

      0  

    Default Answered: Grid Field dateFormat in Tpl

    Answered: Grid Field dateFormat in Tpl


    Hi.
    Im trying to give a grid field with type = date a format (date format) when used in a tpl like the followin code
    Code:
     columns: [{
                header:'Example Column', 
                xtype:'datecolumn', 
                dataIndex:'epaFch', 
                format:'l j \\d\\e M Y',
                width: 250
            },
            {   header:'What i want column', 
                xtype:'templatecolumn', 
                tpl:'{epaFch}<br>{anotherDataIndex}', 
                width: 250
            }
    ]
    The first column shows the date with the format i want and its working fine. (included this column just as a example)

    The second column is using a template where i reference the date field epaFch, in this case shows the default date.toString() text.

    How can i t specify the format to use to render epaFch in that tpl ?
    is this posible ? if not whats the best aproach ?
    1) use a function in renderer : function() that returns the string i want ?
    2) define another column in my Model (calculated) with the string i want so i can reference it in the tpl
    3) In the server side generate another column like epaFchString that has what i want to show ?

    sorry for my english.

  2. Code:
    {
        header: 'What i want column',
        width: 250,
        xtype: 'templatecolumn',
        tpl: Ext.create('Ext.XTemplate', '{epaFch:this.myDateRenderer}<br>{anotherDataIndex}', {
            myDateRenderer: Ext.util.Format.dateRenderer('l j \\d\\e M Y')
        })
    }

  3. #2
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,343
    Answers
    498
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Code:
    {
        header: 'What i want column',
        width: 250,
        xtype: 'templatecolumn',
        tpl: Ext.create('Ext.XTemplate', '{epaFch:this.myDateRenderer}<br>{anotherDataIndex}', {
            myDateRenderer: Ext.util.Format.dateRenderer('l j \\d\\e M Y')
        })
    }

  4. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    200
    Answers
    11
    Vote Rating
    4
    dedoz is on a distinguished road

      0  

    Default


    thank you

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar