Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
-5
rated 0 times [  2] [ 7]  / answers: 1 / hits: 19366  / 13 Years ago, tue, april 26, 2011, 12:00:00

I have button with id = 'someid', i can find it by Ext.getCmp('someid')...



Is there a way to set some kind of extraId to that button, and find that button by extraId'?


More From » extjs

 Answers
8

The question is where you want to search to get your item.



Another way could be the itemId.




An itemId can be used as an alternative way to get a reference to a component when no object reference is available. Instead of using an id with Ext.getCmp, use itemId with Ext.container.Container.getComponent which will retrieve itemId's or id's. Since itemId's are an index to the container's internal MixedCollection, the itemId is scoped locally to the container -- avoiding potential conflicts with Ext.ComponentManager which requires a unique id.




Source and further documentation: http://docs.sencha.com/ext-js/4-0/#/api/Ext.AbstractComponent-cfg-itemId



The ComponentQuery (mentioned by wombleton) is also a good way but maybe not as performant as the itemId.


[#92563] Sunday, April 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amari

Total Points: 736
Total Questions: 111
Total Answers: 90

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;