1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default Unanswered: xtemplate and parsing thru conditon

    Unanswered: xtemplate and parsing thru conditon


    '<tpl for="parent.Data[0]">',
    '{[values.activeImpact]}',
    '<tpl if="parent.Data[1].\'{[values.activeImpact]}\'.greenCount &gt;= 1">',
    do something here
    '</tpl>',
    '</tpl>'
    i want to use the activeImpact value which comes as a output from Data[0] as a field in Data[1]....
    but this error is coming...
    Uncaught SyntaxError: Unexpected string

    any suggestion...

  2. #2
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    606
    Answers
    66
    Vote Rating
    26
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      1  

    Default


    Use template member functions:


    Code:
    new XTemplate(
    '<tpl for="parent.Data[0]">',
    '{[values.activeImpact]}',
    '<tpl if="this.testFunction( parent.parent.Data[1],activeImpact)">',//because here you are inside parent.Data[0]
    do something here
    '</tpl>',
    '</tpl>',
    {
         testFunction:function(arr, key)
         {
                 return arr[key].greenCount >=1;
         }
    }
    )
    or try

    Code:
    '<tpl for="parent.Data[0]">',
    '{[values.activeImpact]}',
    '<tpl if="parent.parent.Data[1][activeImpact].greenCount &gt;= 1">', //because here you are inside parent.Data[0]
    do something here
    '</tpl>',
    '</tpl>'

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default


    hii bluehipy...thnks its working....
    but one problem still persits


    '<tpl if="parent.parent.Data[1][activeImpact].greenCount &gt;= 1">'
    , like 'if' condition i want to use 'for' and tried that.....its not working....any ideas...
    Ex.
    '<tpl for="this.redArr3()">',redArr3: function(){
    return name = 'parent.Data[1].'+activeProfile+'.redArray';
    },

    this is return the right data and for loop is not initited..

  4. #4
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    606
    Answers
    66
    Vote Rating
    26
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    I think you make it wrong again....


    Post data and tpl so I can see your structure.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default


    '<div class="mblcss">',
    '{[this.redArr()]}', //output is parent.Data[1].status1Data.redArray
    '<tpl for="this.redArr()">',
    do something
    '</tpl>',
    '</div>',
    but in line 3 '<tpl for="this.redArr()">', output is not coming...

    '<tpl for=" parent.Data[1].status1Data.redArray"> this is the output which i require

  6. #6
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    606
    Answers
    66
    Vote Rating
    26
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    The problem is what you return in function I think

    this is wrong
    Code:
    redArr3: function()
    {
        return name = 'parent.Data[1].'+activeProfile+'.redArray';
    }
    this might be ok:

    Code:
    '<div class="mblcss">',
    '{[this.redArr()]}', //output is parent.Data[1].status1Data.redArray
    '<tpl for="this.redArr(parent.Data[1],'status1Data','redArray')">',
    do something
    '</tpl>',
    '</div>',
    {
          redArr:function(arr,ke1,ke2)
          {
                  return arr[key1][key2];
           }
    }

  7. #7
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default


    nopes...this is not working...
    i guess for accept the array that's y its not taking text as the parameter while if takes boolean that's y its accepting the return of function..

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