Hello Support,
I am trying to recognize a date field properly within a ListGrid so that my users can sort against it. The data is delivered in XML via a RESTful data source. My first step was to just get the date rendering within the ListGrid and that is working fine. Now I am trying to recognize the dsGSADateModifiedField (see below) as a Date object and get it to sort properly within the ListGrid.
I have seen other forum questions about this topic, but I could not identify a fix to my specific use case. Could you share some advice?
Details Below:
SmartClient Version: SC_SNAPSHOT-2011-08-02/PowerEdition Deployment (built 2011-08-02)
XML Data Source Sample:
Code Snippets
The dates are displayed within the ListGrid, but they do not sort properly. They appear to be recognized as Text fields.
Thanks for reviewing this.
I am trying to recognize a date field properly within a ListGrid so that my users can sort against it. The data is delivered in XML via a RESTful data source. My first step was to just get the date rendering within the ListGrid and that is working fine. Now I am trying to recognize the dsGSADateModifiedField (see below) as a Date object and get it to sort properly within the ListGrid.
I have seen other forum questions about this topic, but I could not identify a fix to my specific use case. Could you share some advice?
Details Below:
SmartClient Version: SC_SNAPSHOT-2011-08-02/PowerEdition Deployment (built 2011-08-02)
XML Data Source Sample:
Code:
<record> <id>2</id> <gsa_date_modified>20-Nov-10</gsa_date_modified> ... </record>
Code:
// Placed within onModuleLoad method.
DateUtil.setDateParser(new DateParser()
{
public Date parse(String dateString)
{
final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("dd-MMM-yy");
return dateTimeFormat.parse(dateString);
}
});
// Field definition for data source.
DataSourceDateField dsGSADateModifiedField = new DataSourceDateField("gsa_date_modified", "GSA Date Modified");
// Field definition for ListGrid
ListGridField lgLastModifiedDateField = new ListGridField("gsa_date_modified", "Date", 75);
lgLastModifiedDateField.setType(ListGridFieldType.DATE);
Thanks for reviewing this.
Comment