The amateur programmer
The amateur programmer

Reputation: 1308

Proper way of adding stuff to senchas carousell in runtime

So how can I add stuff to carousell in sencha touch 2.x?

var c = Ext.create('Ext.Carousel', {
            fullscreen: true,

            defaults: {
                styleHtmlContent: true
            },

            items: [
                {
                    html : 'Item 1'
                }]
        });

If I want to, for example, push a form f to the carousell how can I do that? I have already tried c.push(f) and c.add(f) but I can't see my form being added there.

Upvotes: 1

Views: 48

Answers (1)

The amateur programmer
The amateur programmer

Reputation: 1308

The proper way of adding stuff into a container like Ext.Carousel is using the add() function. You can also define your carousel like this, if you want to just add all your stuff to it in runtime:

var c = Ext.create('Ext.Carousel', {
            fullscreen: true,

            defaults: {
                styleHtmlContent: true
            }

            });

Now you can use the c.add(f) function. Also to remove the object f from the carousel or other container c use c.remove(f)

Upvotes: 2

Related Questions