brianraymes opened a new issue #848:
URL: https://github.com/apache/royale-asjs/issues/848
An item cannot be added to an ArrayList bound to a DataContainer.
**Steps to Reproduce**
1. _Create a bindable ArrayList_
```
[Bindable]
public var names:ArrayList = new ArrayList(["A", "B", "C"]);
```
2. _Create a DataContainer (non-highlightable and non-selectable list of
itemRenderers)_
```
<j:DataContainer dataProvider="{names}">
<j:beads>
<js:CollectionChangeUpdateForArrayListData/> <!-- Uncertain if
necessary -->
</j:beads>
</j:DataContainer>
```
3. _Attempt to add an item_
```
names.addItem("D");
```
**Expected Results**
Item is added and displays in the DataContainer.
**Actual Results**
The following error is produced:
```
TypeError: Error #1034: Type Coercion failed: cannot convert
org.apache.royale.jewel.beads.models.DataProviderModel to
org.apache.royale.core.ISelectionModel
at Function.org.apache.royale.utils.Language.as
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\utils\Language.js:115:12)
at
org.apache.royale.html.beads.DataItemRendererFactoryForCollectionView.itemAddedHandler
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\html\beads\DataItemRendererFactoryForCollectionView.js:89:56)
at
org.apache.royale.collections.ArrayList.org.apache.royale.events.EventDispatcher.fireListeners
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\events\EventDispatcher.js:100:24)
at Function.goog.events.EventTarget.dispatchEventInternal_
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\library\closure\goog\events\eventtarget.js:381:27)
at
org.apache.royale.collections.ArrayList.org.apache.royale.events.EventDispatcher.dispatchEvent
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\events\EventDispatcher.js:74:38)
at org.apache.royale.collections.ArrayList.addItemAt
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\collections\ArrayList.js:160:9)
at org.apache.royale.collections.ArrayList.addItem
(c:\dev\uc\apps\web\royale\target\javascript\bin\js-debug\org\apache\royale\collections\ArrayList.js:126:9)
. . .
```
**Observations**
It appears that each _item<Added|Updated|Removed>Handler_ method within
DataItemRendererFactoryForCollectionView assumes that the data model belongs to
a list that contains a selectable index. The DataContainer is not selectable,
therefore does not contain a selectable index.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]