Don't you need to call the name of the field you defined in your RecordDef?
Try to call it in your ColumnModel.
ColumnConfig normalizedDateColumn =
new ColumnConfig("The Name of the column",
"DATE_SORTFIELD_DATE", 150, true,new Renderer()
{
public String render(Object value,
CellMetadata cellMetadata,
Record record, int rowIndex,
int colNum, Store store) {
Date date=new Date((String)value);
DateTimeFormat fmt =
DateTimeFormat.getFormat("mm/dd/yyyy");
String formatted=fmt.format(date);
return(formatted);
}
}
);
-------------
DATE_SORTFIELD_DATE, because that's the name under where your data probably
is.
if you still don't see it, try to log what you are getting inside the
renderer:
public String render(Object value, CellMetadata cellMetadata, Record record,
int rowIndex, int colNum, Store store) {
GWT.log( "date value: "+value.toString(), null );
Date date=new Date((String)value);
DateTimeFormat fmt = DateTimeFormat.getFormat("mm/dd/yyyy");
String formatted=fmt.format(date);
return(formatted);
}
And, if this doesn't help then what is the value you are getting?
Dariusz
On Fri, Jan 16, 2009 at 9:39 AM, Tanzeem M.B <[email protected]> wrote:
>
>
> On Fri, Jan 16, 2009 at 12:07 PM, Dariusz Borowski <[email protected]>wrote:
>
>> How does your RecordDef look like?
>>
>
> final RecordDef recordDef =
> new RecordDef(new FieldDef[] {
> new IntegerFieldDef("DATE_SORTFIELD_DATE_ID"),
> new DateFieldDef("DATE_SORTFIELD_DATE"),
> new StringFieldDef("DATE_SORTFIELD_DATE_STRING"),
> new StringFieldDef("DATE_SORTFIELD_LIST_COLOR")});
>
>>
>> Are you getting any data?
>>
>> yes, im retrieving data from a database and this linked to the grid store
>> using Store. Im getting data in other columns, but in the specified column i
>> dont get any if the rendered ive written is used.
>>
>>
>>
>> On Fri, Jan 16, 2009 at 7:26 AM, tanzeem <[email protected]> wrote:
>>
>>>
>>> I have a gridPanel with one of the RecordDef as DateFieldDef .I tried
>>> to format the output in the format 09/01/2009
>>> using the following code, but its not working.The column becomes blank
>>> with no entries populated when i tried to do the formatting. Please
>>> help.
>>>
>>> ColumnConfig normalizedDateColumn =
>>> new ColumnConfig("NORMALIZEDDATE",
>>> "SORTFIELD_DATE", 150, true,new Renderer()
>>> {
>>>
>>> public String render(Object value,
>>> CellMetadata cellMetadata,
>>> Record record, int
>>> rowIndex, int colNum, Store store) {
>>>
>>> Date date=new Date((String)value);
>>> DateTimeFormat fmt =
>>> DateTimeFormat.getFormat("mm/dd/yyyy");
>>> String formatted=fmt.format(date);
>>>
>>> return(formatted);
>>>
>>> }
>>>
>>> }
>>> );
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---