View Full Version : date field editor
Hello, i have a problem with the date field editor. when i edit the date, i don't understand how to work with the render, as it' show the date like this : 'thu Jan 15 ....'. I want like this : '15/01/08' for example.
this is my code :
if(field.name=="livraison"){
cols[i] = {
header:field.name,
dataIndex:field.name,
renderer:'formatDate',
editor:new Ext.form.DateField({
fieldLabel: 'Date de livraison',
name: 'livraison',
width:100,
allowBlank:false,
renderer:'formatDate'
})};
and 'formatDate function ':
function formatDate(value){
return value ? value.dateFormat('M/d/Y') : '';
}
if someone could explain me? i don't understand...
thanks
renderer:'formatDate',
should be:
renderer:formatDate,
If you put a BP in formatDate() you'll see it wasn't being called. Additionally, it shouldn't be included twice - you've also included it in the DateField config.
Why not use the format (http://extjs.com/deploy/ext/docs/output/Ext.form.DateField.html#config-format) config option with the DateField config instead? Haven't checked this but it should work:
//...
editor:new Ext.form.DateField({
fieldLabel: 'Date de livraison',
name: 'livraison',
width:100,
allowBlank:false,
format:'m/d/Y'
})
//...
thanks for your help, but it doesn't work. when i use "format:'d/m/Y' it appears in my dateField the correct value for 1 or 2 seconde, and it appears after the value "Sun Dec 16 2007 00:00:00 GMT+1000" .... ???
Have you looked at the Inline Editing (edit-grid.js) (http://extjs.com/deploy/ext/examples/grid/edit-grid.html) example? This works fine, try basing your code on that:
function formatDate(value){
return value ? value.dateFormat('m/d/y') : ''; // return value ? value.dateFormat('M d, Y') : '';
};
// ...
},{
header: "Available",
dataIndex: 'availDate',
width: 95,
renderer: formatDate,
editor: new Ed(new fm.DateField({
format: 'm/d/y',
minValue: '01/01/06',
disabledDays: [0, 6],
disabledDaysText: 'Plants are not available on the weekends'
}))
},{
// ...
i ve always this problem.. i don't understand why!! i have the following error : "value.dateFormat is not a function".
i have tested with an alert: "10/12/08"..
Does the Inline Editing (http://extjs.com/deploy/ext/examples/grid/edit-grid.html) example work on your machine? If so, can you post a short example of yours that doesn't work...
reignile
07-24-2008, 12:32 AM
I have the same problem here. Don't know why, edit-grid.js works well,but my own page doesn't work.
Hello, i have a problem with the date field editor. when i edit the date, i don't understand how to work with the render, as it' show the date like this : 'thu Jan 15 ....'. I want like this : '15/01/08' for example.
this is my code :
if(field.name=="livraison"){
cols[i] = {
header:field.name,
dataIndex:field.name,
renderer:'formatDate',
editor:new Ext.form.DateField({
fieldLabel: 'Date de livraison',
name: 'livraison',
width:100,
allowBlank:false,
renderer:'formatDate'
})};
and 'formatDate function ':
function formatDate(value){
return value ? value.dateFormat('M/d/Y') : '';
}
if someone could explain me? i don't understand...
thanks
kevinhou
11-04-2008, 10:10 PM
Hello,I have a try.var store1 = new Ext.data.SimpleStore({ fields:[ {name: 'date',type: 'date'}, ]});In the fields of simplestore,you must enter " type: 'date' ".
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.