Cloning ExtJS Components Using JQuery

I am trying to clone form components using JQuery.clone () (in fact, I am cloning a collection of fields by cloning a container element). Everything went well, except the date field, comboboxes don't work, even checking for minLength, etc. Also doesn't work.

BTW, I am just converting the old html form fields to ext js form fields using applyTo

+1


source to share


2 answers


The problem is that jQuery clone () doesn't clone event handlers associated with DOM elements. But even if you use clone (true) this copies the event handlers, it still doesn't work because you also need to clone the Ext object from the JavaScript side.



You really need to use the tools provided by Ext to create a lot of similar controls. A good place to start is to create custom Ext components that you can more easily manage multiple points.

+2


source


For starters, you can try using

.clone(true) 

      



therefore, all event handlers for the element are copied. Also, I suspect Extjs does some other fancy stuff when creating its controls, so this is probably just the first step to getting it working. Looking around on the extjs forums, I don't see much information on cloning widgets.

+1


source







All Articles