Threaded View
-
29 Jan 2013 10:59 PM #1
[4.2.0 beta 2] BasicForm doesn't get dynamically added items
[4.2.0 beta 2] BasicForm doesn't get dynamically added items
REQUIRED INFORMATION
Ext version tested:- Ext 4.2.0 beta 2
- Chrome
- IE9
- <!DOCTYPE html>
- A BasicForm doesn't get dynamically added items if they are not added directly to a FormPanel, but somewhere down in hierarchy. So, they are not submitted.
- It works with ExtJS 4.1.1.
- As a workaround we reset "_fields" after adding new items. It forces the fields query to be re-executed.
Code:formPanel.getForm()._fields = null;
Steps to reproduce the problem:- Click the "add" button
- Click the "getFields" button
- "1" in the alert box, i.e. one field in the BasicForm
- "0" in the alert box
Code:<!DOCTYPE html> <html> <head> <title>BasicForm doesn't get dynamically added items</title> <link rel="stylesheet" href="../resources/css/ext-all.css" /> <script src="../ext-all-debug.js"></script> <script> Ext.onReady(function () { Ext.create("Ext.button.Button", { renderTo: Ext.getBody(), text: "Add a field to the interim container", handler: function () { Ext.getCmp("SomeInterimContainer1").add({ xtype: "textfield", value: "Hello" }); } }); Ext.create("Ext.button.Button", { renderTo: Ext.getBody(), text: ".getFields().getCount()", handler: function () { alert(Ext.getCmp("FormPanel1").getForm().getFields().getCount()); } }); Ext.create("Ext.form.Panel", { id: "FormPanel1", renderTo: Ext.getBody(), items: [{ id: "SomeInterimContainer1", xtype: "container" }] }); }); </script> </head> <body> </body> </html>
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-8386
in
4.2.0 Sprint 4 (GA).


Reply With Quote