1. #1
    Sencha User
    Join Date
    Nov 2012
    Location
    India
    Posts
    20
    Vote Rating
    0
    shri_iitk is on a distinguished road

      0  

    Default Unanswered: How to add panel as list item

    Unanswered: How to add panel as list item


    I am trying to dynamically add list(with its items) to my container. Instead of simple HTML template, I need list items to contain panel with a title bar, image & few more things.To do this I am loading store data and within its callback creating List & array of items. Then I add items to the list and list to the container but end result is just last panel visible instead of sliding list of all panels.Here is my code:

    Code:
    var vLists = [];
        this.load({
            callback: function(records, operation, success) {
                var hccontainer = Ext.getCmp('hccontainer');
                this.each(function(record){
                    var sid = 'styleStore'+record.get('id');
                    var styleTemplate = eval('tpls.styleTemplate_' + record.get('id'));
                    vLists.push({
                        xtype: 'panel',
                        scrollable: 'false',
                        layout: 'fit',
                        cid : record.get('id'),
                        ctype : record.get('type'),
                        cname : record.get('name'),
                        stid : sid,
                        tp : styleTemplate,
                        items: [
                            {
                                xtype : 'titlebar',
                                title : record.get('name'),
                                docked : 'top',
                                cls : 'x-toolbar-transparent-top'
                            },
                            {
                                xtype : 'image',
                                src : record.get('image'),
                            }
                        ]
                    });
                });
                //hccontainer.remove(Ext.getCmp('hc'), true);
                Ext.getCmp('hc').destroy();
                var hc1 = Ext.create('Ext.dataview.List', {
                    layout : 'fit',
                    config: {
                        direction: 'horizontal',
                        id : 'hc'
                    }
                });
                hc1.setItems(vLists);
                Ext.getCmp('hccontainer').add(hc1);
            },
            scope: this
        });
    Is this right way to add items or I am missing something.
    PS Instead of List if I use Carousel, this works fine

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    434
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    In Sencha Touch 2.1 you can use components just like DataView using the ListItem.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Location
    India
    Posts
    20
    Vote Rating
    0
    shri_iitk is on a distinguished road

      0  

    Default


    Can you please elaborate? DO you mean I can add dataview in a list item?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    434
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You can use any component within a List
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Location
    India
    Posts
    20
    Vote Rating
    0
    shri_iitk is on a distinguished road

      0  

    Default


    Then it should have worked for me because I am adding Panel as list item and I am using 2.1

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    434
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Depends how you are doing it and how you want it to look.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

Tags for this Thread