1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    7
    Vote Rating
    0
    yann Offredi is on a distinguished road

      0  

    Default Unanswered: Tpl is not work in dataview object

    Unanswered: Tpl is not work in dataview object


    Hi,

    I use ST2.0 - RC. And my problem is the config "tpl" don't work in dataview. This is my code for test :
    Code:
    {
    xtype:'dataview', style:'border:1px dotted yellow', data: [
    {name: 'Jamie', age: 100}, {name: 'Rob', age: 21}, {name: 'Tommy', age: 24}, {name: 'Jacky', age: 24}, {name: 'Ed', age: 26} ],
    height:"400px", tpl: ['test'],
    The result in chrome is empty, and in the inspector I have this :

    HTML Code:
    <div id="ext-component-3" class="x-dataview-container">
    <div class="x-dataview-item" id="ext-element-15"><div></div></div>
    <div class="x-dataview-item" id="ext-element-16"><div></div></div>
    <div class="x-dataview-item" id="ext-element-17"><div></div></div>
    <div class="x-dataview-item" id="ext-element-18"><div></div></div>
    <div class="x-dataview-item" id="ext-element-19"><div></div></div>
    </div>
    Have you ideas ?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    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


    Use itemTpl not tpl.
    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
    Dec 2011
    Posts
    7
    Vote Rating
    0
    yann Offredi is on a distinguished road

      0  

    Default


    Ok, But my data is just an example. My real data is an associative data like this :

    Code:
    Data: [
    {categorie: 'main',  [{entities:1},{entities:56},{entities:76},{entities:12}]},            
    {categorie: 'main2', [{entities:2},{entities:45},{entities:65},{entities:78}]},
    {categorie: 'main3', [{entities:4},{entities:13},{entities:65},{entities:67}]},
    ]
    And my wish is to have this html format :

    HTML Code:
    <div class="showMain"><h2>main</h2>
    <ul><li>1</li>
    <li>56</li>
    <li>76</li>
    <li>12</li></ul>
    <h2>main2</h2>
    <ul><li>1</li>
    <li>45</li>
    <li>65</li>
    <li>78</li></ul>
    <h2>main3</h2>
    <ul><li>2</li>
    <li>13</li>
    <li>65</li>
    <li>67</li></ul></div>
    And "li" must be "tapable" but not h2.

    In 1.x is easy!!

    But how can I do with 2.0 ?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    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


    You only have access to each row's template, you don't have the overall template.
    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.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    16
    Vote Rating
    1
    trkaky is on a distinguished road

      0  

    Default


    Why is that?

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    16
    Vote Rating
    1
    trkaky is on a distinguished road

      0  

    Default


    and how to align items horizontally? Hack into the css and update x-dataview-item class?

    EDIT: for horizontal align; "inline:true"

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Answers
    3447
    Vote Rating
    814
    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


    Quote Originally Posted by trkaky View Post
    Why is that?
    This is the way ST2 was developed.
    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.

Thread Participants: 2

Tags for this Thread