Are you talking about AdvancedDataGridColumn.dataField?

From: Carlos Rovira<mailto:carlosrov...@apache.org>
Sent: Monday, August 10, 2020 6:36 PM
To: Apache Royale Development<mailto:dev@royale.apache.org>
Subject: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction 
emulation with jewel datagrid)

Hi,

while adding labelFunction support I notice we have "labelField" that seems
newer API and dataField.
Seemes dataField is not used (need to check better).
I think if that's the case we can remove dataField to avoid confusion.
I can check for it and if not used remove

thoughts?

Side note: I added LabelFunction bead to use in renderers, but just added
to two jewel renderers. But I think is a good PAYG approach, so feel free
to add to Basic taking Jewel ListItemRenderer or DataGridItemRenderers as
reference to use that code.

Thanks


---------- Forwarded message ---------
De: Carlos Rovira <carlosrov...@apache.org>
Date: lun., 10 ago. 2020 a las 17:31
Subject: Re: mx:advancedDataGridColumn labelFunction emulation with jewel
datagrid
To: <us...@royale.apache.org>


Hi Nicolas,

just added support for labelFunction in Jewel in List and DataGrid
(globally and at column level).
Since this depends on the item renderer, for other components not using
ListItemRenderer or DataGridItemRenderer we should implement it.

examples:

List:
<j:List width="100%" height="300" className="tableStyle"
labelField="label" selectedIndex="1"
dataProvider="{listModel.iconListData}">
<j:beads>
<js:LabelFunction labelFunction="formatLabel"/>
</j:beads>
</j:List>

private function formatLabel(item:Object):String {
return " - " + item.label;
}

DataGrid:

<j:DataGrid localId="dg1"
change="lb1.html = describeItem(event.target.selectedItem)"
initComplete="loadDataProvider(dg1)">
<!-- <j:beads> // you can use LabelFunction to affect all columns and
renders
<js:LabelFunction labelFunction="formatLabel"/>
</j:beads> -->
<j:columns>
<j:DataGridColumn label="Title" dataField="title"/>
<j:DataGridColumn label="Sales" dataField="sales" labelFunction=
"formatLabel"/>
<!-- // or if you just need it in a concrete column declare just there like
above this line-->
</j:columns>
</j:DataGrid>

import org.apache.royale.jewel.supportClasses.datagrid.IDataGridColumnList;

private function formatLabel(item:Product, column:IDataGridColumnList):
String {
if (column.labelField == "sales")
return item.sales + " €";
return getLabelFromData(column, item);
}



HTH

Carlos


El mié., 5 ago. 2020 a las 17:52, tranquiliste (<nicolas.agut...@gmail.com>)
escribió:

> Hello all,
>
> with mx: AdvancedDatagridColumn, there were a labelFunction property which
> allowed to execute a function on each value of a column. Is it possible and
> how to do the same  with jewel DataGrid?
> I want ot do somthing very simple to display '--' when value is empty or
> null
>
> Thanks
> Nicolas
>
>
>
> -----
> Nicolas
> --
> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>


--
Carlos Rovira
http://about.me/carlosrovira



--
Carlos Rovira
http://about.me/carlosrovira

Reply via email to