JavaScript Switch view with ExtJS switch view in android,switch view in outlook,switch view

It looks pretty easy but I'm unable to do it. I want to change the view after click on login button, this is my code:

app.js

Ext.require ('Ext.container.Viewport');
Ext.application({
  name: 'MyApp',
  appFolder: 'app',
  views: [
    'Login',
    'Main'
  ],
  controllers:[
    'Login'
  ],
  launch: function() {
    Ext.create('Ext.container.Viewport', {
      layout: 'fit',
      items: [{
        xtype: 'loginView'
      }]
    });
  }
});

Login.js (View)

Ext.define('MyApp.view.Login' ,{
  extend: 'Ext.panel.Panel',
  alias : 'widget.loginView',

  title: 'MyApp',
  layout: {
    type: 'hbox',
    pack: 'center',
    padding: 50
  },
  defaults: {
    border: false,
    width: 400,
    height: 400
  },
  items: [{
    xtype: 'panel',
    html: '<img src="resources/img/img.jpg" />'
  }, {
    xtype: 'loginForm'
  }]
});

Ext.define('MyApp.view.LoginForm', {
  extend: 'Ext.form.Panel',
  alias: 'widget.loginForm',
  title: 'PSSP',
  bodyPadding: 5,
  layout: 'anchor',
  fieldDefaults: {
    labelAlign: 'top',
    labelWidth: 100,
    labelStyle: 'font-weight:bold'
  },
  defaults: {
    anchor: '100%',
    margins: '0 0 10 0',
    allowblank: false,
    xtype: 'textfield',
  },
  items: [{
    fieldLabel: 'User',
    name: 'username',
    itemId: 'username',
  }, {
    fieldLabel: 'Password',
    name: 'password',
    itemId: 'password',
    inputType: 'password',
  }],
  buttons:[{
    text: 'Login',
    listeners: {
      click: function() {
        var username = this.up('form').down('#username').getValue();
        var password = this.up('form').down('#password').getValue();
        this.fireEvent('login', username, password);
        //Ext.Msg.alert('Datos', 'User: ' + username + '<br>Password: ' + password);
      }
    }
  }]
});

Login.js (Controller)

Ext.define('MyApp.controller.Login', {
  extend: 'Ext.app.Controller',
  init: function() {
    this.control({
      'loginView button': {
        login: this.loginUser
      }
    });
  },
  loginUser: function(username, password) {
    // check if the username and password is valid
    Ext.create('Ext.container.Viewport', {
      items:[{
        xtype: 'mainView'
      }]
    });
  }
});

Main.js (View)

Ext.define('MyApp.view.Main' , {
  extend: 'Ext.container.Viewport',
  alias : 'widget.mainView',

  layout: 'border',
  items: [{
    region: 'north',
    title: 'MyApp'
  }, {
    region: 'west',
    width: 250,
    html: 'WEST'
    //xtype: 'westView'
  }, {
    region: 'east',
    width: 250,
    html: 'EAST'
    //xtype: 'eastView'
  }, {
    region: 'center',
    html: 'CENTER'
    //xtype: 'centerView'
  }]
});

What I have to change to load MainView when I click on login button??? Now, when I click on it, Chrome shows this error:

Uncaught HierarchyRequestError: A Node was inserted somewhere it doesn't belong.

What's wrong in my code?

Thanks!

Answer:1

I have an array which I want to order by date in Angular.js: <tr ng-repeat="er in vm.readerFeeds | orderBy:'-publishedDate'"> <td>{{er.publishedDate}}</td> </tr> The list ...

I have an array which I want to order by date in Angular.js: <tr ng-repeat="er in vm.readerFeeds | orderBy:'-publishedDate'"> <td>{{er.publishedDate}}</td> </tr> The list ...

  1. angular order by date
  2. angular orderby date pipe
  3. angular order by date desc
  4. angular orderby date not working
  5. angular orderby date string
  6. angular orderby date descending
  7. angularjs orderby date
  8. angularjs orderby date string
  9. angularjs orderby date not working
  10. angularjs orderby date desc
  11. angularjs orderby datetime
  12. angularjs orderby date format
  13. angular order by datetime
  14. angularjs orderby date and time
  15. angular 2 orderby date example
  16. angular 6 orderby date
  17. angular 2 orderby date
  18. angular ngfor orderby date
  19. angular 2 orderby date pipe
  20. angular 6 orderby date pipe

I'm using this expression: "g{field1}={field2}a".match(/{([^\{\}]+)\}/g) What I need is to get "field1" and "field2", but it returns an array with "{field1}" and "{field2}".

I'm using this expression: "g{field1}={field2}a".match(/{([^\{\}]+)\}/g) What I need is to get "field1" and "field2", but it returns an array with "{field1}" and "{field2}".

  1. regular expression match any character
  2. regular expression match string
  3. regular expression match python
  4. regular expression match word
  5. regular expression match number
  6. regular expression match exact string
  7. regular expression match anything
  8. regular expression match multiple words
  9. regular expression match space
  10. regular expression match whitespace
  11. regular expression match period
  12. regular expression match newline
  13. regular expression match substring
  14. regular expression match javascript
  15. regular expression match parentheses
  16. regular expression match end of string
  17. regular expression match special characters
  18. regular expression match all characters
  19. regular expression match group
  20. regular expression match character

Firstly, I have checked these out: How can I get a Google Visulization LineChart to display vertical gridlines? Google Chart: AreaChart vAxis Gridlines is Not Drawing And they don't seem to be quite ...

Firstly, I have checked these out: How can I get a Google Visulization LineChart to display vertical gridlines? Google Chart: AreaChart vAxis Gridlines is Not Drawing And they don't seem to be quite ...

Is there a way to detect all AJAX calls (both GET and POST)? I need to do a generic way to show a loading div while the AJAX call process are running. Something like the code below: $.ajax({ url: '...

Is there a way to detect all AJAX calls (both GET and POST)? I need to do a generic way to show a loading div while the AJAX call process are running. Something like the code below: $.ajax({ url: '...

  1. asp.net generic handler ajax call
  2. ajax call generic handler
  3. jquery ajax generic handler
  4. ajax generic handler