PDA

View Full Version : renderTo is not working in Ext.form.field.Number



josephkirubakaran
29 Jan 2012, 6:40 AM
Hello,

Can you tell me why renderTo property for Ext.form.field.Number is not rendering the field?

I have a input field and trying to render as a Ext number field. But the same is working when I use div.

skirtle
29 Jan 2012, 5:57 PM
I think you've misunderstood the role of renderTo.

It renders the component into the specified element, the element does not become part of the component. You can't render a component into an input element.

I don't believe there's a built-in way to do that kind of transformation for a number field. I suspect you'll need to remove the input element and render the field in its place.

josephkirubakaran
30 Jan 2012, 12:35 AM
I think you've misunderstood the role of renderTo.

It renders the component into the specified element, the element does not become part of the component. You can't render a component into an input element.

I don't believe there's a built-in way to do that kind of transformation for a number field. I suspect you'll need to remove the input element and render the field in its place.

Actually I am upgrading Extjs from 3 to 4. There are MANY input fields in my application. In Ext 3 we have converted those html input field to Ext numeric field using Ext.query on load of every page. So I think removing all html inputs in all pages is not possible. Is there any way to acheive this functionality without disturbing the web pages?

Can you help me to doing this? Thanks in advance!

skirtle
30 Jan 2012, 12:40 AM
When I say 'remove' I don't mean editing any HTML code. I just mean grabbing them (possibly using Ext.query) and switching the DOM elements in JavaScript.

josephkirubakaran
30 Jan 2012, 12:42 AM
When I say 'remove' I don't mean editing any HTML code. I just mean grabbing them (possibly using Ext.query) and switching the DOM elements in JavaScript.

Ok skirtle. If possible can you give me an example for this?

skirtle
30 Jan 2012, 12:55 AM
I don't have one off-hand. Give it a go and let us know how you get on.

josephkirubakaran
30 Jan 2012, 9:33 AM
I don't have one off-hand. Give it a go and let us know how you get on.

Sure Skirtle.