PDA

View Full Version : Add new fields dynamically to an existing Form Panel



url
15 Apr 2013, 9:59 PM
I want to add new fields placed inside a container ( layout:hbox ) to the FormPanel dynamically by dragging and dropping.
While dropping in Form panel I'm able to add fields(container) dynamically. But i want to add in the position where they dropped.



var dynamicField = Ext.create('Ext.container.Container',{
layout : 'hbox',
items: [{
xtype:'textfield',
fieldLable:'Test'

}, {
xtype : 'image',
src : 'images/cancel.png',
hidden : true
}]
});
formPanel.add(dynamicField);
//tried dynamicField.showAt(e.getXY());


no luck with dynamicField.showAt(e.getXY()) //e is the event object
Can anybody suggest me how can i achieve?
Regards URL

slemmon
17 Apr 2013, 9:44 AM
I've not done anything like that myself, but you might look at the source of Ext.ux.BoxReorder (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.ux.BoxReorderer). It does something rather like what you're describing.