Threaded View

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    41
    Answers
    7
    Vote Rating
    0
    dshookowsky is an unknown quantity at this point

      -1  

    Default Answered: Calling custom functions in XTemplate

    Answered: Calling custom functions in XTemplate


    I've defined a custom function in an XTemplate, but when the page loads, I see:
    Uncaught Error: [ERROR][Ext.XTemplate#apply] Cannot read property 'calcDuration' of undefined

    My template is included below. What needs to be done to reference the function in the template? (Note: this template is in an object applied to a parent class. I'm not sure if that matters. The rest of the information is displayed correctly as long as I don't include the duration function.

    Code:
                itemTpl : new Ext.XTemplate([
                    '<tpl for=".">',
                    '<div class="formBody meeting">',
                    '    <div class="label">Name</div>',
                    '    <div class="field">{meetingName}</div>',
                    '    <div class="label meetingDate">Date</div>',
                    '    <div class="label meetingStartTime">Start Time</div>',
                    '    <div class="label meetingDuration">Duration (optional)</div>',
                    '    <div class="field meetingDate">{meetingDate}</div>',
                    '    <div class="field meetingStartTime">{meetingStartTime}</div>',
                    '    <div class="field meetingDuration">',
                    '        { [this.calcDuration(values.meetingStartTime, values.meetingEndTime)] }',
                    '    </div>',
                    '    <div class="label">Meeting Location (optional)</div>',
                    '    <div class="field">{meetingLocation}</div>',
                    '    <div class="label">General Information (optional)</div>',
                    '    <div class="field">{comments}</div>',                
                    '</div>',
                    '</tpl>'
                    ].join(''),
                    {
                        calcDuration: function(meetingStartTime, meetingEndTime) {
                            console.log('calcDuration');
                            if (meetingStartTime && meetingEndTime) {
                              /* convert meetingTimes to 24h format */
                             
                             /* subtract meetingStartTime from meetingEndTime */
                                 
                            } else {
                                returnString = '(unspecified)';
                            }
                            return returnString;
                        }
                    })

  2. I had formatted my function call as { [ ] } instead of {[ ]} (note spaces between curly and square braces).

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi