This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6148659  fix the same in the latest commit but this time in List 
component
6148659 is described below

commit 6148659b4afd27ba64b46e647c785acad9e153b0
Author: Carlos Rovira <[email protected]>
AuthorDate: Thu Aug 23 22:05:51 2018 +0200

    fix the same in the latest commit but this time in List component
---
 .../royale/JewelExample/src/main/royale/ListPlayGround.mxml | 13 +++++++++++++
 .../JewelExample/src/main/royale/TablePlayGround.mxml       |  2 ++
 .../itemRenderers/AddListItemRendererForArrayListData.as    |  7 ++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml 
b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
index 6b60d03..8402b40 100644
--- a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
@@ -49,11 +49,23 @@ limitations under the License.
                                list.dataProvider = new ArrayList(["blue", 
"red", "yellow", "green"]);
                        }
 
+                       private function changeListData():void
+                       {
+                               iconList.dataProvider = new ArrayList([
+                                       new IconListVO("CheckBox", "check_box"),
+                                       new IconListVO("Label", "label"),
+                                       new IconListVO("RadioButton", 
"radio_button_checked"),
+                                       new IconListVO("Text", "subject"),
+                                       new IconListVO("TextInput", 
"text_fields")            
+                               ]);
+                       }
+
                        private function addItem():void
                        {
                                var iconListVO:IconListVO = new IconListVO("New 
Item", MaterialIconType.CLOSE);
                                
                                (iconList.dataProvider as 
ArrayList).addItem(iconListVO);
+                               // listModel.iconListData.addItem(iconListVO); 
// to test things are adding to right place
                        }
 
                        public function removeItemAt():void
@@ -118,6 +130,7 @@ limitations under the License.
                                                
<j:RemoveAllItemRendererForArrayListData/>
                                        </j:beads>
                                </j:List>
+                               <j:Button text="change data" 
emphasis="{Button.PRIMARY}" click="changeListData()"/>
                                <j:Button text="Add item" click="addItem()"/>
                                <j:Button text="Remove first item" 
click="removeItemAt()"/>
                                <j:Button text="Update first item" 
click="updateFirstItem()"/>
diff --git a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml 
b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
index b873dfc..36131a3 100644
--- a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
@@ -222,6 +222,8 @@ limitations under the License.
                        private function addItem():void
                        {
                                (table.dataProvider as 
ArrayList).addItem({icon: MaterialIconType.CLOSE, guitarrist: "Eric Johnson", 
album: "Venus Isle", year: "1996"});
+
+                               // tablesModel.guitarrists.addItem({icon: 
MaterialIconType.CLOSE, guitarrist: "Eric Johnson", album: "Venus Isle", year: 
"1996"}); // to test things are adding to right place
                        }
 
                        public function removeItemAt():void
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
index c4bc590..0d7aaed 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
@@ -96,12 +96,17 @@ package org.apache.royale.jewel.beads.itemRenderers
                        dataProviderChangeHandler(null);
                }
                
+               private var dp:IEventDispatcher;
                /**
                 * @private
                 */
                protected function dataProviderChangeHandler(event:Event):void
                {
-                       var dp:IEventDispatcher = 
dataProviderModel.dataProvider as IEventDispatcher;
+                       if(dp)
+                       {
+                               
dp.removeEventListener(CollectionEvent.ITEM_ADDED, handleItemAdded);
+                       }
+                       dp = dataProviderModel.dataProvider as IEventDispatcher;
                        if (!dp)
                                return;
                        

Reply via email to