Do we really need to explicitly add Sencha View to Viewport? -


in examples on sencha touch 2 see code samples like:-

//contents of app.js ext.application({     name: 'myapp',     views: ['myview'],      launch: function() {         ext.create('myapp.view.myview');     } }); 

however, code generated sencha cmd like:-

//contents of app.js ext.application({     name: 'myapp',     views: ['myview'],      launch: function() {         // destroy #apploadingindicator element         ext.fly('apploadingindicator').destroy();          ext.viewport.add(ext.create('myapp.view.myview')); // <--- notice line     } }); 

notice example code did not add newly instantiated view viewport actual code did. both codes equivalent? in example code, how view add viewport or optional?

ext.viewport container layout set 'card'.

in first sample, class should have config option 'fullscreen' set true. setting fullscreen:true automatically add comoponent viewport when instance created.

ext.define('myapp.view.test', {     extend: 'ext.container',                 config: {         fullscreen:true,         html: ['screen2'].join("")     } });      ext.create('myapp.view.test'); 

from doc fullscreen

force component take 100% width , height available, adding ext.viewport.

in second sample, component added viewport. (don't need fullscreen option). adding panel container.

ext.define('myapp.view.home', {     extend: 'ext.container',     xtype: 'homecontainer',                 config: {         html: ['test'].join("")     } }); ext.viewport.add(ext.create('myapp.view.home')); 

from doc viewport

because ext.viewport extends ext.container, has layout (which defaults ext.layout.card). means can add items @ time, anywhere in code. ext.viewport fullscreen configuration true default, take whole screen.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -