动态标签内容添加问题

时间:2013-08-16 06:31:44

标签: sencha-touch sencha-touch-2 tabpanel

这里我的代码在sencha。我有一个4个标签当在任何标签内容中单击按钮操作时,新标签已动态添加到标签栏中。我的代码

var wishlist = {
            standardSubmit : false,
            items: [
                    {
                    xtype: 'fieldset',
                    scope:this,
                    defaults: {
                    required: true,
                    labelAlign: 'left',
                    },
                    title: 'hom',
                    items: [                              
                            {
                            xtype: 'textfield',
                            name : 'password',
                            label: 'Category',
                            useClearIcon: true
                            },{
                            xtype: 'textfield',
                            name : 'password',
                            label: 'Location',
                            useClearIcon: true
                            }],
                     },
                     {
                             xtype:  'button',
                             text:   'Add Wish',
                             ui:     'confirm',
                             handler: function()
                             {
                            //Here when i click other view has been added in tab bar
                            view.setActiveItem(0, {type:'fade', direction:'left'});
                            view.setActiveItem({
                                       title: 'Add Wish',
                                       items: [wishlist]
                                       });

                     });
                      },
                    }]
            };

标签栏整合代码

  var view = Ext.create('Ext.TabPanel', {
                       fullscreen: false,
                       tabBarPosition: 'bottom',
                       items: [{
                               title: 'HOME',
                               iconCls: 'home',
                               items: [{
                                       xtype: 'toolbar',
                                       title: 'My Items',
                                       },wishlist]

                               },
                               {
                               title: 'ITEMS',
                               iconCls: 'star',
                               items: [{
                                       xtype: 'toolbar',
                                       title: 'Add Items',
                                       },signinformBase]
                               },
                               {
                               title: 'PROFILE',
                               iconCls: 'user',
                               items: [{
                                       xtype: 'toolbar',
                                       title: 'MY PROFILE',
                                       },wishlist]
                               },{
                               title: 'FRIENDS',
                               iconCls: 'team',
                               items: [{
                                       xtype: 'toolbar',
                                       title: 'FRIENDS',
                                       },wishlist]
                               },

                       });

请帮我整理一下

1 个答案:

答案 0 :(得分:1)

您需要从sencha docs开始,然后开始构建一些简单的应用程序。

了解Sencha Class System

在sencha框架文件夹中有一个示例文件夹,你可以在那里找到许多例子,用它来开始学习并试验它。

然后,您需要了解一些更具体的概念,如Store和MVC Pattern

如果您不熟悉MVC,那么

MVC in Depth Part 1

MVC in Depth Part 2

Useful SO link