views:

86

answers:

2

What's the proper way to get the position of an element on the page relative to the document?

offsety/x is the jquery variant: http://docs.jquery.com/CSS/offset

I need the EXTJS variant please.

Edit

Possible problem. Because grid components are not part off the dom, the grid height is not taken into consideration. I think I need a callback on the reload function off the grid, but I don´t yet know how to do that.

A: 

Each component has getEl() method, that will return Ext.Element object. This in turn has getXY(),getX() and getY() methods (as well as several others that might be useful for you)

Mchl
I have just a div(no components), so I use Ext.get(´footer´)
Richard
`Ext.get()` returns `Ext.Element` objects as well
Mchl
getY() is not usefull in this way, it´s the same as getTop(). I does not take the document into account. jquery offset gives me 680 and getY() will give me 400?
Richard
getX/Y() return page coordinates. getTop() returns page coordinates unless you pass true as an arg, then it's local coords. If the coordinates are not correct you must have some other issue.
bmoeskau
Thank you,bmoeskau, I have read more answers from you on other posts with Extjs. The solution to this post was to use a callback.The real problem is related to this post http://stackoverflow.com/questions/3864973/ext-js-problem-setting-height-dynamicly-of-a-grid-when-autoheight-is-already-set Could you please take a look at that one.
Richard
A: 

Essa porcaria não tem nada a ver com o meu problema.

Salomão