PDA

View Full Version : ApplyTo function missing in Extjs4.2



rishu27
24 Jul 2013, 4:47 AM
Earlier ext controls are having applyTo function which Apply the behaviors of the ext component to an existing element. Please specify now how we can achieve the same functionality provided by applyTo.
Please help, its urgent!!!!

slemmon
25 Jul 2013, 10:03 PM
See if renderTo is what you're looking for
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.panel.Panel-cfg-renderTo

rishu27
14 Aug 2013, 4:05 AM
Please help!!!
Extjs 4.2.1 no longer supported applyTo for controls. After migration to Extjs 4.2.1, some of the major functionality has been stopped due to applyTo.


Ext.create(Ext.form.TextField', {
applyTo: 'fromdate',
hideLabel: true
});
.....


<input type="text" id="fromdate">



For comboBox, applyTo has been replaced by transform but for textbox transform is not working. Please help in getting proper solution. Is there any override to get the applyTo for ExtJS 4.2.1

suzuki1100nz
14 Aug 2013, 10:02 PM
slemmon is correct try using renderTo

http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.AbstractComponent-cfg-renderTo

rishu27
16 Aug 2013, 1:29 AM
I have already tried it using renderTo, it is throwing error "htmlfile: Invalid target element for this operation.".

slemmon
16 Aug 2013, 7:07 AM
In the renderTo config did you specify as the value the ID of an element (usually a div) on the page where you want the component rendered to?

rishu27
18 Aug 2013, 8:40 PM
I did like this


Ext.create(Ext.form.TextField',
{renderTo: 'fromdate',hideLabel: true}
);.....

<input type="text" id="fromdate">



'fromdate' is the id of element on which i want to render a ext textfield. I don't want to render ext textfield on to a div. renderTo needs a container control while applyTo can render a control on to any Html control.

rishu27
20 Aug 2013, 3:16 AM
Please help me!!!!

slemmon
20 Aug 2013, 9:24 AM
The applyTo config is not missing from 4.2 - it's not included in 4.x at all.

If you're looking to place a component on the page at a specific postion you can instantiate the component and render it to a div, span, anchor, etc. Though, it is not advisable to render a component to a specific element if the component is to be managed by a parent container.

In ExtJS 4 if what you're wanting to do is write up HTML and have it translated to an ExtJS component I'd suggest instead configuring the component in your JS and rendering it to the element where you want it placed - again, this assumes the component is stand-alone on the page and not being managed by a parent layout.

rishu27
22 Aug 2013, 2:32 AM
If its not included then there should be something which works exactly same.