Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 12-06-2007, 05:39 AM
bereal's Avatar
bereal bereal is offline
Ext JS Premium Member
 
Join Date: Apr 2007
Location: Geneva, Switzerland
Posts: 88
bereal is on a distinguished road
Send a message via ICQ to bereal
Question Several important questions

Hello and thank you for the great job

I've got a couple of questions which seem very important for me:


1. is there the way to know what Class is the particular object is member of?
For example:

var viewport = new Ext.Viewport();
console.log(Ext.gimmeClass(viewport)) // i want "Ext.Viewport" here...
2. Most of examples show creating of Layout items during creation of Layout itself. We use different approach and are used to add them dynamically after creation of Layout.

I like the Viewport component, let it have default layout Ext.layout.ContainerLayout:
var viewport = new Ext.Viewport();
How its supposed to add, for example, EditorGridPanel, to the created Viewport?

Documentation of Viewport and or ContainerLayout tells me absolutely nothing about adding items. I tried viewport.add, viewport.getLayout().add, and etc - it doesnt work
Reply With Quote
  #2  
Old 12-06-2007, 06:06 AM
santosh.rajan's Avatar
santosh.rajan santosh.rajan is offline
Ext User
 
Join Date: Sep 2007
Location: Kannur, Kerala, India
Posts: 611
santosh.rajan is on a distinguished road
Default

Every ext container (viewport included) have a getEl() method which returns the underlying ext element. See docs for Element.
When you add a component to a container you call its doLayout() method. In your case it is
viewport.doLayout() after you add.
Reply With Quote
  #3  
Old 12-06-2007, 06:58 AM
SeaSharp2 SeaSharp2 is offline
Ext User
 
Join Date: Dec 2007
Posts: 141
SeaSharp2 is on a distinguished road
Default

	myViewPort.add( myGridPanel );
	myViewPort.doLayout();
Re. the other question about dynamic querying for an object's class type... unlike some other JavaScript prototype extention libraries I have not noticed a classname attribute in Ext objects.
Reply With Quote
  #4  
Old 12-06-2007, 07:00 AM
bereal's Avatar
bereal bereal is offline
Ext JS Premium Member
 
Join Date: Apr 2007
Location: Geneva, Switzerland
Posts: 88
bereal is on a distinguished road
Send a message via ICQ to bereal
Default

Thanks guyz.

I read about Viewport that it automatically redraws everything by itself and had no idea that I need to do it myself )

its very pity abt first question
Reply With Quote
  #5  
Old 12-06-2007, 08:48 AM
brian.moeskau's Avatar
brian.moeskau brian.moeskau is offline
Ext JS Contributor
 
Join Date: Mar 2007
Location: Austin, Texas
Posts: 3,258
brian.moeskau is on a distinguished road
Default

You can use basic JavaScript functions like typeof for determining JS object type. You can also use several methods of Component like isXType, getXType and getXTypes to determine the Ext-specific class types.
__________________
Brian Moeskau
FAQ / Tutorials / User Extensions / Enhanced Forum Search
Reply With Quote
  #6  
Old 12-06-2007, 10:06 AM
SeaSharp2 SeaSharp2 is offline
Ext User
 
Join Date: Dec 2007
Posts: 141
SeaSharp2 is on a distinguished road
Default

Quote:
Originally Posted by brian.moeskau View Post
You can also use several methods of Component like isXType, getXType and getXTypes
Nice! Looks like a recent enhancement.

I went back and read up on the typeof JavaScript operator, it will only return 'object' according to the docs.
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 11:15 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.