Ext. componentquery. Query ()

Source: Internet
Author: User

All containers used to find features (ext. Container. Container) or all specific components through Ext. componentmanager
1. When looking for a component, it is equivalent to calling ext. componentquery. Query ()
The following parameters can be received:
1) xtype
// Find all components whose xypte is panel
VaR panelsarray = ext. componentquery. Query ('panel ');
2) Itemid or ID attribute value of the component
Find all panel components with the ID of myct. Note the space representation and operation (&&)
VaR panelswithinmyct = ext. componentquery. Query ('# myct panel ');
Note:> direct, bean or operation
// Component of the panel in the direct sub-element whose ID is myct
VaR directchildpanel = ext. componentquery. Query ('# myct> panel ');
// Gridpanel and treepanel Components
VaR gridsandtrees = ext. componentquery. Query ('gridpanel, treepanel ');
3) search by attribute
// Indicates that if the component has the autoscroll attribute, it will be in progress.
VaR panelswithinmyct = ext. componentquery. Query ('component [autoscroll] ');
VaR panelswithinmyct = ext. componentquery. Query ('panel [Title = "test"] ');
Panel [Title = "test"]
4) According to some expression attributes of the component, if the return value of the expression is true, the corresponding component is
// If the call isdisabled () of the component is true, the component is selected.
VaR disabledfields = myformpanel. Query ("{isdisabled ()}");
5) pseudo-class selector (pseudo classes)
The default include not, last,
// Find the final panel component in the document
VaR panelsarray = ext. componentquery. Query ('panel: la ');
// Custom
Ext. componentquery. pseudo dos. Invalid = function (items ){
VaR I = 0, L = items. length, C, result = [];
For (; I <L; I ++ ){
If (! (C = items [I]). isvalid ()){
Result. Push (C );
}
}
Return result;
};
VaR invalidfields = myformpanel. Query ('field: invalid ');
If (invalidfields. Length ){
Invalidfields [0]. getel (). scrollintoview (myformpanel. Body );
For (VAR I = 0, L = invalidfields. length; I <L; I ++ ){
Invalidfields [I]. getel (). Frame ("red ");
}
}

2. When searching for a container
You can use Ext. Container. Container. Query (). This method uses the container as the root element to call ext. componentquery. Query
Ext. Container. Container. Down
Ext. Container. Container. Child
Ext. component. Up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.