-
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>
-
30 Jan 2013 12:51 AM #2
I've moved this to the 4.2.0 Beta forum - thanks for the report by the way!
This area was impacted by performance work in the component life-cycle (add and remove events no longer bubble) and it was a bit tricky to achieve its goals without creating a performance drain on all components and containers. In case you were interested in all that
We'll get this squared away.Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
30 Jan 2013 12:55 AM #3
I knew there was more than idle interest I had in mind in mentioning the above ... due to that change, the form / basicform no longer tracks references to all of its descendant fields - it gathers them when needed.
This tends to be a bargain vs burdening the life-cycle of all components and containers to track this for use in an infrequently called method (typically called based on user interaction).Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
30 Jan 2013 3:44 AM #4
Thank you for the answer, Don.
Should I post all beta release issues in this forum? Just I already posted many ones in the Bugs forum and this is the first time when the thread was moved to the Beta forum.
Thank you for the explanation of the root of the issue. I guessed it.
So, the fields should be re-requested each getFields call? (It is about how you are going to fix it. Just curios.)
-
30 Jan 2013 9:40 AM #5
It is not necessary, but helps somewhat get the right people to see the report. During beta, the dev team is more actively looking at beta issues and they focus in the beta forum. The bugs forum is more focused on support of current released versions.
All that is just internal -and we don't always move them around since once they are processed internally it does not matter too much where they live on the forum.
Yes, each call to getFields will have to acquire the current set (deeply). Internally, to determine valid / dirty state, we will probably use ComponentQuery and the "down" method to see if there are any invalid or dirty fields. Still a bit TBD, but I would avoid calling getFields in a loop or anything
Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
30 Jan 2013 9:09 PM #6
-
10 Mar 2013 7:13 PM #7
Which version?
Which version?
I seem to have this bug in ext-4.2.0.489. Is there a newer download available? or a path to beta source code?
(Sorry still a bit new to forums and where things are at).
Cheers
-
11 Mar 2013 7:19 AM #8
The last public download is 4.2 RC. I think it is Sprint 3.
This bug is marked fixed in Sprint 4. So, it will be available with the next public download.
So, currently, it should be available in SVN only. So, I don't know the location.
-
18 Mar 2013 11:28 AM #9
Did not work form me(accidental pun). After dynamically changing my form, I had to use:Code:formPanel.getForm()._fields = null;
This affected my form when using getFields, and submit.Code:form.getForm().monitor.invalidateItems();
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