Hi,

You can format your column[1] display as follows:

 Column dateColumn = new Column("minListDate");
 dateColumn.setFormat("{0,date,dd MMM yyyy}");
table.addColumn(dateColumn);


Kind regards,

Bob

[1]: http://click.apache.org/docs/click-api/org/apache/click/control/Column.html


On 24/10/2010 13:23, C Jennings wrote:
> Hello  -
> I am running into a problem when trying to display a Date pattern 
> (YYYY-MM-dd) 
> on an org.apache.click.control.Table
> . 
> I have a HtmlForm that uses the DateField type for 2 fields. Once the form is 
> populated and committed to the database, I return to the main page and invoke 
> a 
> Decorator pattern (below) to display the populated date fields from the 
> HtmlForm. 
>
> However, when I cast that row object to MyProfile, the values for minListDate 
> and maxListDate show the time values again (all zeros). However, even though 
> it 
> works, it unfortunately shows Date and Time values on my table. I set their 
> data 
> type to java.Util.Date to match what I was using in the HtmlForm for 
> DateField. 
> As such, this gives me the time values as well.
>
> Does anyone have any input here on how I could just display the Date value on 
> that table? I have tried changing the datatypes to use java.sql.Date package. 
> This worked fine for displaying the Date on my table but then it caused 
> problems 
> with using DateField which relies on the java.Util.Date package.
>
> Anyways hope I have explained this somewhat clearly. I've spent some time 
> trying 
> various parsing techniques with no luck.
>
> Many thanks!
>
> Conor
>
> myTable = new Table("myTable");
>
> myTable.addColumn(new Column("minListDate"));
> myTable.addColumn(new Column("maxListDate"));
>
> Column actionColumn = new Column("Action", "Edit | Delete");
>
>     actionColumn.setDecorator(new Decorator() {
>
>    public String render(Object row, Context context) {
>
>    MyProfile myProfile = (MyProfile) row;
>    String id = String.valueOf(myProfile.getId());
>
>    editYourProfileLink.setParameter("id", id);
>    editYourProfileLink.setImageSrc("images/add.gif");
>    editYourProfileLink.setTitle("Edit Your Profile");
>
>    deleteYourProfileLink.setValue(id);
>    deleteYourProfileLink.setImageSrc("images/cross.png");
>    deleteYourProfileLink.setTitle("Delete Your Profile");
>
>    return editYourProfileLink.toString() + " | " + 
> deleteYourProfileLink.toString();
> }
> });
>
>     myTable.addColumn(actionColumn);
>            
>     <etc>
>
>
>       
>

Reply via email to