I love error messages that are vague and don’t really spell out what the problem is, especially when you’re first learning a new language or technology.
Most of the time a google search turns up the answer pretty quickly, but this one didn’t turn up much.
Luckily, it turned out to be a typo: I forgot to put in a couple lines while using an AdvancedDataGrid – I think anything that uses columns of data would do the same thing.
I think you can also get this error or something similar if you bind data to a dataprovider – such as dataProvider=”{myArrayCollection}” and then you also set the dataProvider in your code, such as component.dataProvider = myArrayCollection, but more then likely you’ll just an app that doesn’t load data correctly.
Anyway, the error verbatim is “Multiple initializers for property ‘dataProvider’. (note: ‘dataProvider’ is the default property of ‘mx.controls.AdvancedDataGrid’).”
So my code, using a bindable array collection (ac), looks like this.
1 2 3 4 | <mx:AdvancedDataGrid id="adgICMP" dataProvider="{ac}" width="100%" height="100%"> <mx:AdvancedDataGridColumn dataField="field1" headerText="header1" /> <mx:AdvancedDataGridColumn dataField="field2" headerText="header2"/> </mx:AdvancedDataGrid> |
Guess what’s missing? Yep, columns. Apparently not using
1 2 3 4 5 6 | <mx:AdvancedDataGrid id="adg" dataProvider="{ac}" width="100%" height="100%"> <mx:columns> <mx:AdvancedDataGridColumn dataField="field1" headerText="header1" /> <mx:AdvancedDataGridColumn dataField="field2" headerText="header2"/> </mx:columns> </mx:AdvancedDataGrid> |
If I used something like adg.dataProvider = ac in actionscript, the code would compile with no errors, although I wouldn’t get the results I wanted and it would dump out all the values in ArrayCollection
Aubrey says:
Flex multiple initializers are HOT
21st March 2010 at 11:13 am
Alexey says:
Thank you, you saved my day
21st March 2010 at 11:01 am