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 4a82d5b  fi the same as before but this time for remove all items
4a82d5b is described below

commit 4a82d5b44ca8fcb413f2eb3ccbec678b2f7eac24
Author: Carlos Rovira <[email protected]>
AuthorDate: Thu Aug 23 22:11:15 2018 +0200

    fi the same as before but this time for remove all items
---
 examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml   | 1 +
 examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml  | 4 ++--
 .../beads/itemRenderers/RemoveAllItemRendererForArrayListData.as   | 7 ++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml 
b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
index 8402b40..e735869 100644
--- a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml
@@ -83,6 +83,7 @@ limitations under the License.
                        public function removeAllData():void
                        {
                                (iconList.dataProvider as 
ArrayList).removeAll();
+                               // listModel.iconListData.removeAll();
                        }
                ]]>
        </fx:Script>
diff --git a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml 
b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
index 36131a3..9fe2dec 100644
--- a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
@@ -222,7 +222,6 @@ 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
                        }
 
@@ -240,7 +239,8 @@ limitations under the License.
 
                        public function removeAllData():void
                        {
-                               tablesModel.guitarrists.removeAll();
+                               (table.dataProvider as ArrayList).removeAll();
+                               // tablesModel.guitarrists.removeAll();
                        }
                ]]>
        </fx:Script>
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveAllItemRendererForArrayListData.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveAllItemRendererForArrayListData.as
index 1707f4b..daec3cb 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveAllItemRendererForArrayListData.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveAllItemRendererForArrayListData.as
@@ -86,12 +86,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.ALL_ITEMS_REMOVED, 
handleAllItemsRemoved);
+                       }
+                       dp = dataProviderModel.dataProvider as IEventDispatcher;
                        if (!dp)
                                return;
                        

Reply via email to