You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by tranquiliste <ni...@gmail.com> on 2020/08/05 15:47:34 UTC

mx:advancedDataGridColumn labelFunction emulation with jewel datagrid

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/

Re: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Posted by Carlos Rovira <ca...@apache.org>.
Hi Yishay,

check this image [1]

are the occurrences of dataField in Basic
marked in red are what I think are the real uses of dataField, that are
using really labelField.
Then you can see more code in interfaces and beads that seems not used, or
that can be tuned for remove of "dataField"

Basically I'm proposing to have just "labelField" instead of both
"labelField" and "dataField", unless others know some reason about what we
have both. For example, DataFieldProviderBead seems like a bead we can
remove, since it's use seems just dead code like I found yesterday in Jewel.

[1] https://imgur.com/a/EjAOpAf

El mar., 11 ago. 2020 a las 12:14, Yishay Weiss (<yi...@hotmail.com>)
escribió:

> It’s possible I should have been following the thread more closely but I
> still don’t understand what you’re proposing to remove. Which class in
> Basic has dataField?
>
> From: Carlos Rovira<ma...@apache.org>
> Sent: Tuesday, August 11, 2020 12:40 PM
> To: Apache Royale Development<ma...@royale.apache.org>
> Subject: Re: labelField vs dataField (Fwd: mx:advancedDataGridColumn
> labelFunction emulation with jewel datagrid)
>
> Hi Yishay,
>
> no. MX/SPARK had a dataField, so I think that's needed for emulation
> in MXRoyale.
> I refer to BASIC. For what I read from Alex while looking at the right way
> to do labelFunction we talked about "labelField" as the Basic API.
> But there's a DataFieldProviderBead that, at least in Jewel, was not used
> at all, and I removed yesterday, still need to track Basic.
> Since I don't know much more about MXRoyale it is possible that MXRoyale
> could use dataField from Basic, or that some components in Basic use
> dataField, in that case maybe there's no mucho to do. But if it was an API
> introduced at the beginning and now is finally not used we could save some
> bits and confusion removing it from the code base
>
>
>
> El mar., 11 ago. 2020 a las 9:00, Yishay Weiss (<yi...@hotmail.com>)
> escribió:
>
> > Are you talking about AdvancedDataGridColumn.dataField?
> >
> > From: Carlos Rovira<ma...@apache.org>
> > Sent: Monday, August 10, 2020 6:36 PM
> > To: Apache Royale Development<ma...@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 <ca...@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.aguttes@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
> >
> >
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>

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

RE: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Posted by Yishay Weiss <yi...@hotmail.com>.
It’s possible I should have been following the thread more closely but I still don’t understand what you’re proposing to remove. Which class in Basic has dataField?

From: Carlos Rovira<ma...@apache.org>
Sent: Tuesday, August 11, 2020 12:40 PM
To: Apache Royale Development<ma...@royale.apache.org>
Subject: Re: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Hi Yishay,

no. MX/SPARK had a dataField, so I think that's needed for emulation
in MXRoyale.
I refer to BASIC. For what I read from Alex while looking at the right way
to do labelFunction we talked about "labelField" as the Basic API.
But there's a DataFieldProviderBead that, at least in Jewel, was not used
at all, and I removed yesterday, still need to track Basic.
Since I don't know much more about MXRoyale it is possible that MXRoyale
could use dataField from Basic, or that some components in Basic use
dataField, in that case maybe there's no mucho to do. But if it was an API
introduced at the beginning and now is finally not used we could save some
bits and confusion removing it from the code base



El mar., 11 ago. 2020 a las 9:00, Yishay Weiss (<yi...@hotmail.com>)
escribió:

> Are you talking about AdvancedDataGridColumn.dataField?
>
> From: Carlos Rovira<ma...@apache.org>
> Sent: Monday, August 10, 2020 6:36 PM
> To: Apache Royale Development<ma...@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 <ca...@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.aguttes@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
>
>

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


Re: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Posted by Carlos Rovira <ca...@apache.org>.
Hi Yishay,

no. MX/SPARK had a dataField, so I think that's needed for emulation
in MXRoyale.
I refer to BASIC. For what I read from Alex while looking at the right way
to do labelFunction we talked about "labelField" as the Basic API.
But there's a DataFieldProviderBead that, at least in Jewel, was not used
at all, and I removed yesterday, still need to track Basic.
Since I don't know much more about MXRoyale it is possible that MXRoyale
could use dataField from Basic, or that some components in Basic use
dataField, in that case maybe there's no mucho to do. But if it was an API
introduced at the beginning and now is finally not used we could save some
bits and confusion removing it from the code base



El mar., 11 ago. 2020 a las 9:00, Yishay Weiss (<yi...@hotmail.com>)
escribió:

> Are you talking about AdvancedDataGridColumn.dataField?
>
> From: Carlos Rovira<ma...@apache.org>
> Sent: Monday, August 10, 2020 6:36 PM
> To: Apache Royale Development<ma...@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 <ca...@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.aguttes@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
>
>

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

RE: labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Posted by Yishay Weiss <yi...@hotmail.com>.
Are you talking about AdvancedDataGridColumn.dataField?

From: Carlos Rovira<ma...@apache.org>
Sent: Monday, August 10, 2020 6:36 PM
To: Apache Royale Development<ma...@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 <ca...@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 (<ni...@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


labelField vs dataField (Fwd: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid)

Posted by Carlos Rovira <ca...@apache.org>.
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 <ca...@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 (<ni...@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

Re: mx:advancedDataGridColumn labelFunction emulation with jewel datagrid

Posted by Carlos Rovira <ca...@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 (<ni...@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