O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Traversing the DOM

It is important to be able to move around the DOM based on the current context and retrieve references to surrounding elements. In this recipe, we will discover how to use Ext JS to traverse the DOM and access elements based on the context of the current element we are working with.

Getting ready

We will use the HTML snippet from the previous recipe, Selecting DOM elements, to demonstrate how to traverse the DOM, so make sure it is handy!

How to do it...

We will first discuss how to access a DOM element's siblings.

  1. First we retrieve the Ext.Element instance that will be the root of our traversal. In this case we will use the Data Package item in the "What's new in Ext JS 4" list, simply because it is in the middle of the list. We ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required