You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/01/12 21:37:10 UTC
[royale-asjs] branch develop updated: tour-de-jewel: upgrade
datagrid example
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 cdb9880 tour-de-jewel: upgrade datagrid example
cdb9880 is described below
commit cdb98808e4e740acdcf4fda7219c31c723e9bc8d
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Jan 12 22:37:00 2020 +0100
tour-de-jewel: upgrade datagrid example
---
.../TourDeJewel/src/main/royale/DataGridPlayGround.mxml | 14 +++++++++-----
.../TourDeJewel/src/main/royale/models/ProductModel.as | 11 +++++++++++
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index a7f2a03..7c73beb 100644
--- a/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -53,12 +53,14 @@ limitations under the License.
private function addRow():void
{
var product:Product = new Product("xx100","New Item", 44, Math.floor(Math.random()*1000), "assets/smallbluerect.jpg");
- productModel.productList.addItem(product);
+ (datagrid2.dataProvider as ArrayList).addItem(product);
+ // productModel.productList.addItem(product);
}
private function removeFirstRow():void
{
- productModel.productList.removeItemAt(0);
+ (datagrid2.dataProvider as ArrayList).removeItemAt(0);
+ // productModel.productList.removeItemAt(0);
}
private function updateFirstRow():void
@@ -66,12 +68,14 @@ limitations under the License.
var product:Product = productModel.productList.getItemAt(0) as Product;
product.title = "What??";
product.sales = Math.floor(Math.random()*100);
- productModel.productList.itemUpdated(product);
+ (datagrid2.dataProvider as ArrayList).itemUpdated(product);
+ // productModel.productList.itemUpdated(product);
}
public function removeAllRows():void
{
- productModel.productList.removeAll();
+ (datagrid2.dataProvider as ArrayList).removeAll();
+ // productModel.productList.removeAll();
}
[Bindable]
@@ -100,7 +104,7 @@ limitations under the License.
<j:beads>
<js:ConstantBinding
sourceID="productModel"
- sourcePropertyName="productList"
+ sourcePropertyName="fewProductList"
destinationPropertyName="dataProvider"/>
</j:beads>
<j:columns>
diff --git a/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as b/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
index eb89ebe..aff4fb4 100644
--- a/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
+++ b/examples/royale/TourDeJewel/src/main/royale/models/ProductModel.as
@@ -24,6 +24,17 @@ package models
[Bindable]
public class ProductModel
{
+ private var _fewProductList:ArrayList = new ArrayList([
+ new Product("ps100", "Few", 44, 200,"assets/smallbluerect.jpg"),
+ new Product("tx200", "Products", 5, 285,"assets/smallgreenrect.jpg"),
+ new Product("rz300", "On List", 80, 105,"assets/smallyellowrect.jpg")
+ ]);
+
+ public function get fewProductList():ArrayList
+ {
+ return _fewProductList;
+ }
+
private var _productList:ArrayList = new ArrayList([
new Product("ps100","Widgets",44,200,"assets/smallbluerect.jpg"),
new Product("tx200","Thingys",5,285,"assets/smallgreenrect.jpg"),