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 24a0081 tourdejewel: datagrid labelFuncion example at root level
(soon column level)
24a0081 is described below
commit 24a00818378796b9b0efbe4c20a35af5095661fd
Author: Carlos Rovira <[email protected]>
AuthorDate: Mon Aug 10 17:02:11 2020 +0200
tourdejewel: datagrid labelFuncion example at root level (soon column level)
---
.../jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
b/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
index fff0d9e..6d6824f 100644
--- a/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
+++ b/examples/jewel/TourDeJewel/src/main/royale/DataGridPlayGround.mxml
@@ -31,6 +31,8 @@ limitations under the License.
import models.ProductModel;
import org.apache.royale.collections.ArrayList;
+ import org.apache.royale.html.util.getLabelFromData;
+ import
org.apache.royale.jewel.supportClasses.datagrid.IDataGridColumnList;
import
org.apache.royale.jewel.supportClasses.datagrid.IDataGridPresentationModel;
import vos.IconListVO;
@@ -160,6 +162,12 @@ limitations under the License.
this.dgFixedWidth.dataProvider =
listModel.iconDetailListData;
}
}
+
+ private function formatLabel(item:Product,
column:IDataGridColumnList):String {
+ if (column.labelField == "sales")
+ return item.sales + " €";
+ return getLabelFromData(column, item);
+ }
]]>
</fx:Script>
@@ -196,6 +204,9 @@ limitations under the License.
<j:DataGrid localId="dg1"
change="lb1.html =
describeItem(event.target.selectedItem)"
initComplete="loadDataProvider(dg1)">
+ <j:beads>
+ <js:LabelFunction
labelFunction="formatLabel"/>
+ </j:beads>
<j:columns>
<j:DataGridColumn
label="Title" dataField="title"/>
<j:DataGridColumn
label="Sales" dataField="sales"/>