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 adf1d88 add Bindable "dataProviderChanged" and example. We must notice that a reassing in the watched dataprovider variable is not catch by the list, this should be fixed in some way adf1d88 is described below commit adf1d8882080cafab5438e82cf024273ba565f25 Author: Carlos Rovira <carlosrov...@apache.org> AuthorDate: Tue May 22 19:32:46 2018 +0200 add Bindable "dataProviderChanged" and example. We must notice that a reassing in the watched dataprovider variable is not catch by the list, this should be fixed in some way --- .../royale/ListExample/src/main/royale/MyInitialView.mxml | 11 ++++++++++- .../ListExample/src/main/royale/models/ProductsModel.as | 5 +++++ .../html/beads/models/SingleSelectionCollectionViewModel.as | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml index 45c323b..8ca5a76 100644 --- a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml +++ b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml @@ -47,6 +47,7 @@ limitations under the License. <fx:Script> <![CDATA[ import models.ProductsModel; + import org.apache.royale.collections.ArrayList; private function addState():void { @@ -65,6 +66,13 @@ limitations under the License. private function onScrollEnd():void{ trace("scroll end"); } + + private function assignDataProvider():void{ + trace("assign new DataProvider"); + + dynamicList.dataProvider = new ArrayList(['one', 'two', 'three', 'four']); + //(applicationModel as ProductsModel).states = new ArrayList(['one', 'two', 'three', 'four']); <-- this way the list doesn't notice the change + } ]]> </fx:Script> @@ -88,7 +96,7 @@ limitations under the License. <js:Label x="300" y="20" text="A dynamic List" /> - <js:List x="300" y="40" width="200" height="300" className="DynamicList"> + <js:List id="dynamicList" x="300" y="40" width="200" height="300" className="DynamicList"> <js:beads> <js:ConstantBinding sourceID="applicationModel" @@ -100,6 +108,7 @@ limitations under the License. <js:TextButton text="Add New Jersey" x="300" y="350" click="addState()" /> <js:TextButton text="Remove New Jersey" x="300" y="380" click="removeState()" /> + <js:TextButton text="Assign New Data" x="300" y="410" click="assignDataProvider()" /> <!-- A custom list built from DataContainer. --> diff --git a/examples/royale/ListExample/src/main/royale/models/ProductsModel.as b/examples/royale/ListExample/src/main/royale/models/ProductsModel.as index f4601eb..30bbc62 100644 --- a/examples/royale/ListExample/src/main/royale/models/ProductsModel.as +++ b/examples/royale/ListExample/src/main/royale/models/ProductsModel.as @@ -40,6 +40,11 @@ package models { return _states; } + + public function set states(a:ArrayList):void + { + _states = a; + } public var _bigArray:Array; diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/SingleSelectionCollectionViewModel.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/SingleSelectionCollectionViewModel.as index b42a500..df1ba3d 100644 --- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/SingleSelectionCollectionViewModel.as +++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/SingleSelectionCollectionViewModel.as @@ -66,6 +66,7 @@ package org.apache.royale.html.beads.models private var _dataProvider:ICollectionView; + [Bindable("dataProviderChanged")] /** * @copy org.apache.royale.core.ISelectionModel#dataProvider * -- To stop receiving notification emails like this one, please contact carlosrov...@apache.org.