You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Julio C. Rivera" <Ju...@carm.es> on 2004/08/06 14:08:41 UTC
Using Table (with source and columns parameters)
I want to show a table using contrib:FormTable component (using source and
columns parameters).
My table has 2 fields: username (String) and dateOfBirth (Date). I would
like to show the date in dd/MM/yyyy format.
I have tried this:
.page:
...
<component id="usersTable" type="contrib:FormTable">
<binding name="source">
userManager.findUsers
</binding>
<static-binding name="columns">
*username:User:username, dateOfBirth:Date of Birth:dateOfBirth
</static-binding>
<binding name="row">currentRow</binding>
</component>
...
.html:
...
<span jwcid="usersTable" />
<span jwcid="dateOfBirthColumnValue@Block" >
<span jwcid="@Insert"
value="new
java.text.SimpleDateFormat('dd/MM/yyyy').format(currentRow.dateOfBirth)" />
</span>
...
But this has a problem: when I push on the date column header, data is
ordered alphabetically, not by date (it implies that 20/08/2003 >
10/12/2003, and it isn't valid for me).
How can I solve this without build a custom TableModel? any idea?
Thanks in advance.
Julio.
*************************************************
Julio C. Rivera Riquelme
Unidad de Informática
Gerencia de Atención Primaria de Murcia
C\ Escultor Sanchez Lozano, 7
Tfno. 968 39 48 07
*************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using Table (with source and columns parameters)
Posted by "Julio C. Rivera" <ju...@ya.com>.
Ok, thanks!. I will try it.
One note about the '*':
If I remenber correctly, if I don't add '*', the column headers doesn't
submit the form, and if I leave a blank between '*' and 'username' the
column headers doesn't submit the form.
Is this a bug? or I was doing something wrong?
Regards.
Julio.
At 16:09 06/08/2004 +0300, you wrote:
>Modify the columns binding to
>
> <static-binding name="columns">
> * username:User:username, dateOfBirth:Date of Birth:dateOfBirth.time
> </static-binding>
>
>This will make it sort the column by getDateOfBirth().getTime(), rather than
>by getDateOfBirth().toString().
>
>Also, there is no need to add '*' in front in this case, I believe --
>FormTable will add it automatically.
>
>
>----- Original Message -----
>From: "Julio C. Rivera" <Ju...@carm.es>
>To: <ta...@jakarta.apache.org>
>Sent: Friday, August 06, 2004 3:08 PM
>Subject: Using Table (with source and columns parameters)
>
>
>I want to show a table using contrib:FormTable component (using source and
>columns parameters).
>My table has 2 fields: username (String) and dateOfBirth (Date). I would
>like to show the date in dd/MM/yyyy format.
>
>
>I have tried this:
>
>.page:
>...
><component id="usersTable" type="contrib:FormTable">
> <binding name="source">
> userManager.findUsers
> </binding>
> <static-binding name="columns">
> *username:User:username, dateOfBirth:Date of Birth:dateOfBirth
> </static-binding>
> <binding name="row">currentRow</binding>
></component>
>...
>
>.html:
>...
><span jwcid="usersTable" />
><span jwcid="dateOfBirthColumnValue@Block" >
> <span jwcid="@Insert"
> value="new
>java.text.SimpleDateFormat('dd/MM/yyyy').format(currentRow.dateOfBirth)" />
></span>
>...
>
>But this has a problem: when I push on the date column header, data is
>ordered alphabetically, not by date (it implies that 20/08/2003 >
>10/12/2003, and it isn't valid for me).
>
>How can I solve this without build a custom TableModel? any idea?
>
>Thanks in advance.
>
> Julio.
>
>
>*************************************************
>Julio C. Rivera Riquelme
>Unidad de Informática
>Gerencia de Atención Primaria de Murcia
>C\ Escultor Sanchez Lozano, 7
>Tfno. 968 39 48 07
>*************************************************
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using Table (with source and columns parameters)
Posted by "Julio C. Rivera" <ju...@ya.com>.
I tried something like that, implementing getDateOfBirthColumn() returning
a ExpressionTableColumn with a valueRenderer that format the date. But when
I did it, the dateOfBirth column header didn't submit the form (but the
username column header yes).
Is that a bug or I was doing something wrong?
Sorry, I can't to paste the exact code because I leave it at work and I'm
at home.
Regards.
Julio.
At 16:32 06/08/2004 +0300, you wrote:
>Just to mention for completeness:
>
>In other situations one could do:
>
> <static-binding name="columns">
> * username:User:username, =dateOfBirthColumn
> </static-binding>
>
>and then add a getDateOfBirthColumn() method in your code that will return
>the table column.
>
>The column can be defined using ExpressionTableColumn, for example, and its
>behaviour could be made completely custom by using any of the following
>methods: setColumnComparator() or setComparator(), setEvaluator(),
>setSortable(), etc. It may also be prudent to invoke loadSettings() to make
>sure you get the behaviour you normally get when defining the columns using
>a string, e.g. defining the appearance using Blocks and getting localized
>display names, rather than do this manually.
>
>Alternatively, you can just implement ITableColumn and take full control
>over everything, but most of what you need is probably already done for you
>in the standard implementations.
>
>So you have quite a few options there, but in your case the simple
>modification suggested in the previous message is probably quite sufficient
>and none of the above is needed.
>
>Best regards,
>-mb
>
>----- Original Message -----
>From: "Mind Bridge" <mi...@yahoo.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Friday, August 06, 2004 4:09 PM
>Subject: Re: Using Table (with source and columns parameters)
>
>
> > Modify the columns binding to
> >
> > <static-binding name="columns">
> > * username:User:username, dateOfBirth:Date of Birth:dateOfBirth.time
> > </static-binding>
> >
> > This will make it sort the column by getDateOfBirth().getTime(), rather
>than
> > by getDateOfBirth().toString().
> >
> > Also, there is no need to add '*' in front in this case, I believe --
> > FormTable will add it automatically.
> >
> >
> > ----- Original Message -----
> > From: "Julio C. Rivera" <Ju...@carm.es>
> > To: <ta...@jakarta.apache.org>
> > Sent: Friday, August 06, 2004 3:08 PM
> > Subject: Using Table (with source and columns parameters)
> >
> >
> > I want to show a table using contrib:FormTable component (using source and
> > columns parameters).
> > My table has 2 fields: username (String) and dateOfBirth (Date). I would
> > like to show the date in dd/MM/yyyy format.
> >
> >
> > I have tried this:
> >
> > .page:
> > ...
> > <component id="usersTable" type="contrib:FormTable">
> > <binding name="source">
> > userManager.findUsers
> > </binding>
> > <static-binding name="columns">
> > *username:User:username, dateOfBirth:Date of Birth:dateOfBirth
> > </static-binding>
> > <binding name="row">currentRow</binding>
> > </component>
> > ...
> >
> > .html:
> > ...
> > <span jwcid="usersTable" />
> > <span jwcid="dateOfBirthColumnValue@Block" >
> > <span jwcid="@Insert"
> > value="new
> > java.text.SimpleDateFormat('dd/MM/yyyy').format(currentRow.dateOfBirth)"
>/>
> > </span>
> > ...
> >
> > But this has a problem: when I push on the date column header, data is
> > ordered alphabetically, not by date (it implies that 20/08/2003 >
> > 10/12/2003, and it isn't valid for me).
> >
> > How can I solve this without build a custom TableModel? any idea?
> >
> > Thanks in advance.
> >
> > Julio.
> >
> >
> > *************************************************
> > Julio C. Rivera Riquelme
> > Unidad de Informática
> > Gerencia de Atención Primaria de Murcia
> > C\ Escultor Sanchez Lozano, 7
> > Tfno. 968 39 48 07
> > *************************************************
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using Table (with source and columns parameters)
Posted by Mind Bridge <mi...@yahoo.com>.
Just to mention for completeness:
In other situations one could do:
<static-binding name="columns">
* username:User:username, =dateOfBirthColumn
</static-binding>
and then add a getDateOfBirthColumn() method in your code that will return
the table column.
The column can be defined using ExpressionTableColumn, for example, and its
behaviour could be made completely custom by using any of the following
methods: setColumnComparator() or setComparator(), setEvaluator(),
setSortable(), etc. It may also be prudent to invoke loadSettings() to make
sure you get the behaviour you normally get when defining the columns using
a string, e.g. defining the appearance using Blocks and getting localized
display names, rather than do this manually.
Alternatively, you can just implement ITableColumn and take full control
over everything, but most of what you need is probably already done for you
in the standard implementations.
So you have quite a few options there, but in your case the simple
modification suggested in the previous message is probably quite sufficient
and none of the above is needed.
Best regards,
-mb
----- Original Message -----
From: "Mind Bridge" <mi...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, August 06, 2004 4:09 PM
Subject: Re: Using Table (with source and columns parameters)
> Modify the columns binding to
>
> <static-binding name="columns">
> * username:User:username, dateOfBirth:Date of Birth:dateOfBirth.time
> </static-binding>
>
> This will make it sort the column by getDateOfBirth().getTime(), rather
than
> by getDateOfBirth().toString().
>
> Also, there is no need to add '*' in front in this case, I believe --
> FormTable will add it automatically.
>
>
> ----- Original Message -----
> From: "Julio C. Rivera" <Ju...@carm.es>
> To: <ta...@jakarta.apache.org>
> Sent: Friday, August 06, 2004 3:08 PM
> Subject: Using Table (with source and columns parameters)
>
>
> I want to show a table using contrib:FormTable component (using source and
> columns parameters).
> My table has 2 fields: username (String) and dateOfBirth (Date). I would
> like to show the date in dd/MM/yyyy format.
>
>
> I have tried this:
>
> .page:
> ...
> <component id="usersTable" type="contrib:FormTable">
> <binding name="source">
> userManager.findUsers
> </binding>
> <static-binding name="columns">
> *username:User:username, dateOfBirth:Date of Birth:dateOfBirth
> </static-binding>
> <binding name="row">currentRow</binding>
> </component>
> ...
>
> .html:
> ...
> <span jwcid="usersTable" />
> <span jwcid="dateOfBirthColumnValue@Block" >
> <span jwcid="@Insert"
> value="new
> java.text.SimpleDateFormat('dd/MM/yyyy').format(currentRow.dateOfBirth)"
/>
> </span>
> ...
>
> But this has a problem: when I push on the date column header, data is
> ordered alphabetically, not by date (it implies that 20/08/2003 >
> 10/12/2003, and it isn't valid for me).
>
> How can I solve this without build a custom TableModel? any idea?
>
> Thanks in advance.
>
> Julio.
>
>
> *************************************************
> Julio C. Rivera Riquelme
> Unidad de Informática
> Gerencia de Atención Primaria de Murcia
> C\ Escultor Sanchez Lozano, 7
> Tfno. 968 39 48 07
> *************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Using Table (with source and columns parameters)
Posted by Mind Bridge <mi...@yahoo.com>.
Modify the columns binding to
<static-binding name="columns">
* username:User:username, dateOfBirth:Date of Birth:dateOfBirth.time
</static-binding>
This will make it sort the column by getDateOfBirth().getTime(), rather than
by getDateOfBirth().toString().
Also, there is no need to add '*' in front in this case, I believe --
FormTable will add it automatically.
----- Original Message -----
From: "Julio C. Rivera" <Ju...@carm.es>
To: <ta...@jakarta.apache.org>
Sent: Friday, August 06, 2004 3:08 PM
Subject: Using Table (with source and columns parameters)
I want to show a table using contrib:FormTable component (using source and
columns parameters).
My table has 2 fields: username (String) and dateOfBirth (Date). I would
like to show the date in dd/MM/yyyy format.
I have tried this:
.page:
...
<component id="usersTable" type="contrib:FormTable">
<binding name="source">
userManager.findUsers
</binding>
<static-binding name="columns">
*username:User:username, dateOfBirth:Date of Birth:dateOfBirth
</static-binding>
<binding name="row">currentRow</binding>
</component>
...
.html:
...
<span jwcid="usersTable" />
<span jwcid="dateOfBirthColumnValue@Block" >
<span jwcid="@Insert"
value="new
java.text.SimpleDateFormat('dd/MM/yyyy').format(currentRow.dateOfBirth)" />
</span>
...
But this has a problem: when I push on the date column header, data is
ordered alphabetically, not by date (it implies that 20/08/2003 >
10/12/2003, and it isn't valid for me).
How can I solve this without build a custom TableModel? any idea?
Thanks in advance.
Julio.
*************************************************
Julio C. Rivera Riquelme
Unidad de Informática
Gerencia de Atención Primaria de Murcia
C\ Escultor Sanchez Lozano, 7
Tfno. 968 39 48 07
*************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 29.7.2004 ã.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org