Oğuz Çelikdemir
Oğuz Çelikdemir

Reputation: 4980

Selecting child elements of a fieldset

Let's say I have a sample fieldset as follows :

+---| Customer Types | --------------------------+
|                                                |
|   +----------+    +----------+   +---------+   |
|   |  Trader  |    |  Horeca  |   |   SCO   |   |
|   +----------+    +----------+   +---------+   |
|                                                |
+------------------------------------------------+

The fieldset has three buttons which are opening a new window. When an employee click one of the buttons, he/she should fill out some necessary fields. After filling out the forms, he/she will click the submit button the post records. There is no problem thus far.

What I want to do, an employee fill out the form and click the submit button of the opened window, I should disable other buttons to be able to prevent double record.

Here is the questions:

Upvotes: 1

Views: 1059

Answers (2)

dbrin
dbrin

Reputation: 15673

ExtJS provides a ComponentQuery class that lets you find any component anywhere in the page. Additionally some of those CQ methods are added for convience to container components, like the down() method. Using it you can find your components contained within your fieldset. You can search by xtype, itemId or any arbitrary property of your component.

For Components:
    • Ext.getCmp(id)
    • Ext.ComponentQuery.query()
    • up() 
    • down() 
    • nextSibling() 
    • previousSibling()
    • child()
    • previousNode()
plus various find.. Methods

For Elements:
    • Ext.get()
    • Ext.dom.Query() (more on DOM Query http://docs.sencha.com/core/manual/content/domquery.html

Upvotes: 1

kevhender
kevhender

Reputation: 4405

You will want to use an Ext.ComponentQuery. This is built in to each component if you use the down(), up(), and query() methods.

To get what you want, do something like this:

var buttons = myFieldSet.query('button');
for (var i=0; i<buttons.length; i++)
    buttons[i].disable();

Learn more from the docs here: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.ComponentQuery

Upvotes: 1

Related Questions