1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    15
    Vote Rating
    0
    svper is on a distinguished road

      0  

    Default Unanswered: Array Length in XTemplate

    Unanswered: Array Length in XTemplate


    Hi,
    I'm trying to display something if an array is empty in an Xtemplate.

    My code:

    Code:
    '<tr><td class="pendingDocsSignedTableTitle">Signed By:</td></tr>' +                                    
                                        '<tpl if="signedUsers.length == 0">',
                                             '<tr><td class="pendingDocsSignedTableUser">No users signed</td></tr>',
                                         '</tpl>',
                                         
                                         '<tpl for="signedusers">',
                                             '<tpl if="xcount &gt; 0">',
                                                '<tr><td class="pendingDocsSignedTableUser">{sn} - {[this.formatFDate(values.d)]} </td></tr>',
                                             '</tpl>',
                                         '</tpl>',

    BBUT the

    Code:
     '<tpl if="signedUsers.length == 0">',
                                             '<tr><td class="pendingDocsSignedTableUser">No users signed</td></tr>',
                                         '</tpl>',
    part does not seem to work. Anybody have an idea on how to do this ?

  2. #2
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    This because signedUsers key undefined, check for undefined to:
    Code:
    '<tpl if="values.signedUsers == undefined || values.signedUsers.length == 0">'
    demo: http://jsfiddle.net/rJFYS/1/

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    15
    Vote Rating
    0
    svper is on a distinguished road

      0  

    Default


    Thanks for the response... but i just found out why it wouldn't work... and i feel like an .

    i used signedUsers where signedusers is the right one.

    Ty javascript for not throwing decent errors on capitalization


    Sorry for your time

  4. #4
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    No problem)
    //wbr

Thread Participants: 1

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