Search code examples
javascriptextjsextjs4

Extjs 4. location.hash without explicit ids


In my panel I have a navigation tree. On itemclick window scrolls down to a particular form field. I do it like this:

location.hash = 'UID'

So, I can get the element by Ext.getCmp(UID). But I know, that this practice of using ids is not good, because of possible layout crashes. So, I now want to use itemId instead of id, but the problem is how to simulate the same behaviour as of location.hash.


Solution

  • Once you have container of the element and the element itself then call:

    element.scrollIntoView(container, ...);
    

    See Element Docs for details.