View Full Version : ViewPort base class

10 Sep 2014, 6:02 AM

I was just trying to create viewport.js file in my app structure, and i have extended it with a form panel and it was not working.
after that i have extended it with Ext.container.Viewport class and it worked. I know it inherits all the feature of viewport class,
But if i have included "autocreateviewport : true" in app.js then it should create viewport.js file automatically (please correct me if i am wrong on this),
or is it mandatory to extend this class with the Ext.container.viewport ?
and is it required to keep the name of the class viewport.js ?

Along with that do we really require to call the constructor of parent class(me.callparent(arguments))
as i see its working in both the way, any help on this will be appreciated !!

Please reply


10 Sep 2014, 6:13 AM
viewport auto-renders itself to the document body. The formPanel does not. you're not required to extend viewport, but are encouraged to do so if you want an app that takes 100% of the available screen real estate, etc.

10 Sep 2014, 6:31 AM
Thanks for the prompt reply !!

ya thats gud to extend the viewport class, but without extending it will work as u said ?

As i am not able to run the class independently.

And please let me know do we require to call me.callParent() for all the classes we define, for eg. i create a class A which is extending a form panel. so if i dont include the parent constructor it should automatically load all the feature of panel class? as i have extended or included that class too in my library.


12 Sep 2014, 11:05 AM
It depends with what you want. As Jay said, Viewport will render 100% the browser's height and width even as you resize the browser. If you want that automatic handling then use a Viewport with a layout and add your items as your use case dictates.

As for callParent, if you do not execute callParent, you can break inheritance meaning the superclass' code will not execute which may not behave the way you want.

12 Sep 2014, 11:52 PM
Thanks for replying !!