Results 1 to 7 of 7

Thread: Tpl is not work in dataview object

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    7
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    Use itemTpl not tpl.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    You only have access to each row's template, you don't have the overall template.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      0  

    Default

    Why is that?

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    16
    Vote Rating
    1
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    Quote Originally Posted by trkaky View Post
    Why is that?
    This is the way ST2 was developed.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •