1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    0
    ris is on a distinguished road

      0  

    Default Toolbars & Tabbars & new Cards

    Toolbars & Tabbars & new Cards


    Hello everybody

    I'm haveing problems whit adding a Tabbar in the example app from Drew Neil (https://github.com/senchalearn/Forms-demo)
    when i add a buttonbar (tabbar) it wont be running. Here the code

    app/views/users/List.js
    Code:
    App.views.UsersList = Ext.extend(Ext.Panel, {
        initComponent: function(){
            var addButton, testButton, titlebar, buttonbar, list;
    
            addButton = {
                itemId: 'addButton',
                iconCls: 'add',
                iconMask: true,
                ui: 'plain',
                handler: this.onAddAction,
                scope: this
            };
                                     buttonbar = {
                                     xtype: 'toolbar',
                                     dock: 'bottom',
                                     items: [deleteButton, {xtype: 'spacer'}, saveButton]
                                     };
                                     
                                     testButton = {
                                     itemId: 'testButton',
                                     iconCls: 'add',
                                     iconMask: true,
                                     ui: 'confirm',
                                     handler: this.onTestAction,
                                     scope: this
                                     };
            titlebar = {
                dock: 'top',
                xtype: 'toolbar',
                title: 'Laktose-Rechner',
                items: [ testButton, { xtype: 'spacer' }, addButton ]
            };
                                     
            list = {
                xtype: 'list',
                itemTpl: '{name}',
                store: App.stores.users,
                listeners: {
                    scope: this,
                    itemtap: this.onItemtapAction
                }
            };
    
                                     
        Ext.apply(this, {
                html: 'placeholder',
                layout: 'fit',
                dockedItems: [titlebar, buttonbar],
                items: [list]
            });
    
            App.views.UsersList.superclass.initComponent.call(this);
        },
    
                                     onAddAction: function() {
                                     Ext.dispatch({
                                                  controller: 'Users',
                                                  action: 'newForm'
                                                  });
                                     },
    
                                     onTestAction: function() {
                                     Ext.dispatch({
                                                  controller: 'Users',
                                                  action: 'newRechner'
                                                  });
                                     },
    
        onItemtapAction: function(list, index, item, e) {
            Ext.dispatch({
                controller: 'Users',
                action: 'editForm',
                index: index
            });
        }
    });
    
    Ext.reg('App.views.UsersList', App.views.UsersList);
    Adding a new Page/Site/Card
    app/app.js
    Code:
    App = new Ext.Application({
        name: "App",
    
        launch: function() {
            this.views.viewport = new this.views.Viewport();
    
            this.views.usersRechner = this.views.viewport.down('#usersRechner');
            this.views.usersList = this.views.viewport.down('#usersList');
            this.views.usersForm = this.views.viewport.down('#usersForm');
            
        }
    });
    app/controllers/Users.js
    Code:
    Ext.regController('Users', {
        store: App.stores.users,
    
        index: function() {
            App.views.viewport.reveal('usersList');
        },
    
                      newForm: function() {
                      var model = new App.models.User()
                      App.views.usersForm.load(model);
                      App.views.viewport.reveal('usersForm');
                      },
    
                      newRechner: function() {
                      var model = new App.models.User()
                      App.views.usersForm.load(model);
                      App.views.viewport.reveal('usersRechner');
                      },
                      
        editForm: function(params) {
            var model = this.store.getAt(params.index);
            App.views.usersForm.load(model);
            App.views.viewport.reveal('usersForm');
        },
    
        save: function(params) {
            params.record.set(params.data);
            var errors = params.record.validate();
    
            if (errors.isValid()) {
                this.store.create(params.data);
                this.index();
            } else {
                params.form.showErrors(errors);
            }
        },
    
        update: function(params) {
            var tmpUser = new App.models.User(params.data),
                errors = tmpUser.validate()
    
            if (errors.isValid()) {
                params.record.set(params.data);
                params.record.save();
                this.index();
            } else {
                params.form.showErrors(errors);
            }
        },
    
        remove: function(params) {
            this.store.remove(params.record);
            this.store.sync();
            this.index();
        }
    
    });
    app/views/Viewport.js
    Code:
    App.views.Viewport = Ext.extend(Ext.Panel, {
        fullscreen: true,
        layout: 'card',
        
        initComponent: function() {
            Ext.apply(this, {
                items: [
    
                    { xtype: 'App.views.UsersList', id: 'usersList' },
                    { xtype: 'App.views.UsersForm', id: 'usersForm' },
                    { xtype: 'App.views.UsersRechner', id: 'usersRechner' }, // When i write this it won't work
    
                ]
            });
            App.views.Viewport.superclass.initComponent.apply(this, arguments);
        },
    
        reveal: function(target) {
            var direction = (target === 'usersList') ? 'right' : 'left'
            this.setActiveItem(
                App.views[target],
                { type: 'slide', direction: direction }
            );
        }
    });
    The file app/views/users/Rechner.js intends similar code to Form.js (just to look if it's gonna work)

    I hope u understand my bad english and what i mean.

    For this project i'm using sencha Touch 2.1.1, Cordova, ruby, compass
    best regards
    ris

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    828
    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


    Are you using Sencha Touch 1?
    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.

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    5
    Vote Rating
    0
    ris is on a distinguished road

      0  

    Default


    I think you have seen the code i posted and yes maybe i have mixed whit e little from 1 and 2.1.1? What's the different?

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi