Results 1 to 5 of 5

Thread: DataView tpl config - why has this changed?

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    587
    Answers
    25
    Vote Rating
    88
      0  

    Default DataView tpl config - why has this changed?

    In ST1 you could provide a template that runs on the store specified to the DataView. Now it appears that's just not possible. The docs say:

    "Note The data configuration must be set for any content to be shown in the component when using this configuration."

    But even if the data config is specified, the template still outputs nothing.

    My use case is I'm outputting a calendar view using an html table, so need to be able to start/end a <tr> tag every 7 elements. I can't do this using itemTpl as ST2 wants every itemTpl element to be valid HTML5 in isolation.

    So any idea how to get tpl working again in ST2?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    For Ext.dataview.DataView, you should use the itemTpl config, not tpl.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    587
    Answers
    25
    Vote Rating
    88
      0  

    Default

    I get that Mitchell, but in my use case of outputting a table, with a new tr every 7 items, it doesn't work because ST2 wants valid HTML out of every itemTpl instance, so for example this output from one iteration of the itemTpl for Monday's cell:

    Code:
    <tr>
    <td>item cell</td>
    doesn't work, because it's not valid (tr not closed - but it would eventually be closed on sunday's cell)

    See what I mean?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    DataView in ST2 is a lot different than in ST1. For instance DataView extends Container now so each row is an item whereas in ST1 it extended Component and just applied the html from the XTemplate + data to the html.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha Premium Member
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    587
    Answers
    25
    Vote Rating
    88
      0  

    Default

    That makes porting this app from sencha touch 1 a little ugly! Nevermind. Having to listen to updates to the store and manually updating via an xtemplate using data grabbed from the store.

Posting Permissions

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