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 ee70b51 tour-de-jewel: add update example to datagrid from
collection. check that sorting columns refresh the grid.
ee70b51 is described below
commit ee70b51bcbfb53e7cd2e4bfacc3e7bf8897e8bc5
Author: Carlos Rovira <[email protected]>
AuthorDate: Mon Dec 21 22:19:56 2020 +0100
tour-de-jewel: add update example to datagrid from collection. check that
sorting columns refresh the grid.
---
.../jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
b/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index e411bc7..fc9b30e 100644
--- a/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -32,6 +32,7 @@ limitations under the License.
import org.apache.royale.collections.ArrayList;
import org.apache.royale.collections.ArrayListView;
+ import org.apache.royale.collections.IArrayListView;
import org.apache.royale.html.util.getLabelFromData;
import org.apache.royale.jewel.supportClasses.datagrid.DataGridColumn;
import
org.apache.royale.jewel.supportClasses.datagrid.IDataGridColumnList;
@@ -198,6 +199,13 @@ limitations under the License.
grid.columns = cols;
}
+ private function updateSelectedItem():void
+ {
+ var selectedProduct:Product = (dg2.dataProvider as
IArrayListView).getItemAt(dg2.selectedIndex) as Product;
+ selectedProduct.title = "NEW-" +
(Math.floor(Math.random()*1000));
+ (dg2.dataProvider as
IArrayListView).itemUpdated(selectedProduct);
+ }
+
]]>
</fx:Script>
@@ -307,6 +315,8 @@ limitations under the License.
<j:Label localId="lb2" html="DataGrid
selection will be shown here"/>
+ <j:Button text="Update selected title"
click="updateSelectedItem()" emphasis="primary"/>
+
</j:CardPrimaryContent>
<j:CardActions
itemsHorizontalAlign="itemsRight">
<j:IconButton
click="clearDataProvider(dg2)" outlined="true">