Reputation: 281
I want to retrieve ExtJS component by using class name that is I want the same result when I tried to retrieve element by using id. I can do it by using id but there are some issues occurs when I provide id to my components. Below is one item which present on one page and I want to get it on another page (internally pages are connected) by using class name.
{
ref: 'reasonCodeField',
cls: 'reason-code-field',
xtype: 'enumcombo',
enumName: 'SCH.TrackingEventReasonCodes',
allowBlank: false
}
Now how can I get component by using class name?
Upvotes: 1
Views: 716
Reputation: 1901
You can try to call Ext.getCmp
with the ID from the DOM element:
const element = document.querySelector('.reason-code-field');
const component = Ext.getCmp(element.id);
Two big caveats:
Upvotes: 1