1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    5
    Answers
    1
    Vote Rating
    0
    crakocrakoo is on a distinguished road

      0  

    Default Answered: [Ext.dataview.DataView] itemTpl is not working like tpl on Sencha Touch 1

    Answered: [Ext.dataview.DataView] itemTpl is not working like tpl on Sencha Touch 1


    Hello,

    I'm trying to run this code on Sencha Touch 2:
    Code:
    this._myDataView = new Ext.DataView({
        scrollable: false,
        store: this.myStore,
        itemTpl: new myapp.xtemplate.OrderDetail(
                    this,
                    '',
                    ['{[this.someFunctionToDoOneTime()]}',
                    '<div class="someClassToNotShowNamesInThisPost">',
                        '<table>',
                            '<tbody>',
                                '<tpl for=".">',
                                    '{[this.someFunctionToDoEachTime(values)]}',
                                    '<tr>',
                                        '<td colspan="2">',
                                            '<div>{...}</div>',
                                            '<div>{[this....(values....)]}</div>',
                                        '</td>',
                                    '</tr>',
                                '</tpl>',
                            '</tbody>',
                        '</table>',
                    '</div>']),
                itemSelector: 'select.' + this....,
                disableSelection: true
            });
    But on Sencha Touch 2 the tpl loop doesn't work (a table is created for each item).
    For info, i used the tpl and not the itemtpl on Sencha Touch 1 and it worked...
    I've seen the comments on the tpl config from Ext.dataview.DataView but it's not helping...

    Did you find a solution to this problem?

    Thanks

  2. The reason is because each record in the dataview is a container so you only have access to the one record. You can use CSS' display rule to change how the <div> elements render and can then make it act like a table.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3501
    Vote Rating
    854
    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


    The reason is because each record in the dataview is a container so you only have access to the one record. You can use CSS' display rule to change how the <div> elements render and can then make it act like a table.
    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: 1