PDA

View Full Version : Date not rendering properly..



sachin sachdeva
31 Jan 2011, 10:34 PM
Hello sir here is code that i am using in editor grid panel ...My problem is i am not able to render the date in proper format after selecting it from the calender



function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
}


header : 'Release Date<span style="color:red">*</span>',
dataIndex : 'releasedate',
menuDisabled : true,
format : 'm/d/Y',
width : 80,
renderer : formatDate,
editor : new fm.DateField({
name : 'releaseDate',
format : 'm/d/Y',
editable : false,
id : 'releaseDate',
vtype : 'daterange',
vtypeText : 'date should be in mm/dd/yyyy format',
region : 'center',
editable : false,
expiryDateField : 'expiryDate',
minValue : (new Date()).clearTime(),
allowBlank : false
}),
renderer : function(val, metaData) {
metaData.css = 'x-grid3-col x-grid3-cell'; //----using this render as well if this is the problem then plz suggest me how to use this along with date render-------
return val;
}

Condor
1 Feb 2011, 12:17 AM
You specified a 'format' in your column, but it won't be used, because you also specified your own renderer.

You will have to to the date formatting in the renderer yourself, e.g.

renderer: function(val, metaData){
metaData.css = 'x-grid3-col x-grid3-cell';
return Ext.util.Format.date(val, 'm/d/Y');
}

sachin sachdeva
1 Feb 2011, 12:55 AM
thanx condor its working..........fixed:)