【问题标题】:Proper way of adding stuff to senchas carousell in runtime在运行时向 senchas carousell 添加内容的正确方法
【发布时间】:2014-05-24 13:47:01
【问题描述】:

那么如何在 sencha touch 2.x 中向轮播添加内容?

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

            defaults: {
                styleHtmlContent: true
            },

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

例如,如果我想将form f 推送到轮播,我该怎么做? 我已经尝试过c.push(f)c.add(f),但我看不到我的表单被添加到那里。

【问题讨论】:

    标签: javascript extjs sencha-touch-2 carousel


    【解决方案1】:

    Ext.Carousel 等容器中添加内容的正确方法是使用add() 函数。如果您只想在运行时将所有内容添加到它,您也可以像这样定义您的轮播:

    var c = Ext.create('Ext.Carousel', {
                fullscreen: true,
    
                defaults: {
                    styleHtmlContent: true
                }
    
                });
    

    现在您可以使用c.add(f) 函数。还要从轮播或其他容器c 中删除对象f,请使用c.remove(f)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-19
      • 1970-01-01
      • 1970-01-01
      • 2013-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多