1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Lille, France
    Posts
    31
    Answers
    2
    Vote Rating
    1
    Kakahn is on a distinguished road

      0  

    Default Unanswered: Tpl for in a Xtemplate for a dataview

    Unanswered: Tpl for in a Xtemplate for a dataview


    hi,

    i have a dataview with a store and an itemTpl :

    Code:
    {
      xtype: 'dataview',
       id: 'ListeOriginesId',
       ui: 'carto-origines',
       scrollable: 'vertical',
       store: 'Origines',
       selectedId: null
    }
    
    Code:
     var tpl = new Ext.XTemplate(
    '<tpl for=".">',
    '<tpl exec="this.setPourcentages(values)"></tpl>',
    '<div class="carto-origine-item">',
    '<div class="carto-origine-mask"></div>',
    '<div id="carto-origine-{idOrigine}" class="carto-origine-content">',
    '<div class="carto-origine-libelle">{libelle}</div>',
    ......
    
    '<div class="carto-origine-content2-preco">',
    '<div class="carto-origine-content2-preco-title">Préconisations</div>',
    '<tpl for="preconisations">',
         '<div>{preconisation}</div>',
    '</tpl>',    
    '</div>',
    '</tpl>',{    setPourcentages: function (values) {       .....    }});
    Code:
    ItemOrigine.setItemTpl(tpl);
    ItemOrigine.refresh();
    
    The data of the dataview are some string like 'libelle', 'idOrigine', etc. AND an array 'preconisations' with 2 string. That's why i have a <tpl for="preconisations"> to display the preconisations.

    My dataview is rendered with good binding for simple data ( 'libelle, idOrigine, etc....) but the tpl for="preconisations" is not working.

    When i debug my store between the setItemTpl() and the .refresh() on the dataview, i can see :
    • ItemOrigine.getStore().data.items[0]: Ext.apply.create.Class
      • data: Object
        • appreciations: Array[2]
        • completed: false
        • idOrigine: 3
        • libelle: "RC"
        • maitriseReelle: 5.8
        • maitriseSouhaitee: 5
        • nbPrecos: 1
        • nbQuestions: 0
        • nbQuestionsRepondu: 0
        • preconisations: Array[1]
          • 0: Object
            • origine_id: 3
            • preconisation: "Mettre en place un engagement contractuel écrit "

    So i have my array with 1 value but tpl for is not working.

    Someone can help me ? please
    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Hm... just tried myself and it's working for me.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Lille, France
    Posts
    31
    Answers
    2
    Vote Rating
    1
    Kakahn is on a distinguished road

      0  

    Default




    Others infos :

    i have a Origine model :
    Code:
    Ext.define('PRM.model.Origine', {
     extend: "PRM.model.BaseModel",
     requires: ['PRM.model.BaseModel'],
     fields: [ 
        { .... }
     ],
     associations: [
     {
      type: 'hasMany', model: 'PRM.model.Preconisation', name: 'preconisations' },
     { type: 'hasMany', model: 'PRM.model.Appreciation', name: 'appreciations' }
    ]
    
    and 2 others models :

    Code:
    Ext.define('PRM.model.Preconisation', {
       extend: "PRM.model.BaseModel",
       requires: ['PRM.model.BaseModel'],
       fields: [
          { name: 'origine_id', type: 'integer' },
          { name: 'preconisation', type: 'string' }
       ]
       ,
       belongsTo: 'PRM.model.Origine'
    });
    


    Code:
    Ext.define('PRM.model.Appreciation', {
    extend: "PRM.model.BaseModel",
    requires: ['PRM.model.BaseModel'],
    fields: [
       { name: 'origine_id', type: 'integer' },
       { name: 'appreciation', type: 'string' }
    ],
    belongsTo: 'PRM.model.Origine'
    });
    


  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    56
    Vote Rating
    0
    aaronchen2k is an unknown quantity at this point

      0  

    Default '<tpl for="events">' not work to with config: {itemTpl: new Ext.XTemplate(...)

    '<tpl for="events">' not work to with config: {itemTpl: new Ext.XTemplate(...)


    Ext.define('groupmem.view.event.EventList', {
    extend: 'Ext.List',
    alias : 'widget.event_list',
    cls : 'ui-listview',
    config: {
    itemTpl: new Ext.XTemplate(
    '<tpl for=".">',
    '<div data-role="list-divider" role="heading" class="ui-li ui-li-divider ui-btn ui-bar-b ui-li-has-count ui-btn-up-undefined">',
    '{date}',
    '<span class="ui-li-count ui-btn-up-c ui-btn-corner-all">{count}</span>',
    '</div>',
    '<tpl for="events">',
    '<li data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-btn-up-c">',

Thread Participants: 2

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