mangesh
19 Feb 2007, 6:44 PM
I am using 0.33. I have an editor grid that can take BLANK dates.
When the user tries to enter some date using DatePicker, I get the error:
Date.monthNames[...] is null or not an object. Am I doing something wrong?
Hers's the code snippet:
var formatDate = function(value){
if ( value != "Invalid Date" && value != '' && !isNaN(value)) {
var tmpDate = new Date(Date.parse(value));
return tmpDate.dateFormat('M d, Y');
} else {
return;
}
};
var parseDate = function(value){
if ( value != null && value != "" && value != undefined) {
return new Date(Date.parse(value));
} else {
return;
}
};
CM = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ID", width: 75, sortable: true},
{header: "Store#*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "Est Ready Date", width: 75, sortable: true,renderer: formatDate,editor: new yg.DateEditor({allowBlank:true, format:'M d, Y'})},
{header: "Act Ready Date", width: 75, sortable: true,renderer: formatDate,editor: new yg.DateEditor({allowBlank:true, format:'M d, Y'})},
{header: "Name*", width: 75, sortable: true,editor: new yg.TextEditor()},
{header: "Status*", width: 75, sortable: true,editor: new yg.TextEditor(),renderer:formatStatus,editor: new yg.SelectEditor('status')},
{header: "Address*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "City*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "State*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "Chain*", width: 100, sortable: true,editor: new yg.TextEditor(),renderer:formatChain,editor: new yg.SelectEditor('chain')},
{header: "Division*", width: 100, sortable: true,editor: new yg.TextEditor(),renderer:formatDivision,editor: new yg.SelectEditor('division')}
]);
var schema = {
tagName: 'site_browser',
id: 'use-index',
fields: this.arrCols
};
this.DM = new YAHOO.ext.grid.XMLDataModel(schema);
this.DM.setDefaultSort(CM, 0, "ASC");
this.DM.addPreprocessor(2, parseDate);
this.DM.addPreprocessor(3, parseDate);
this.DM.addListener('load', this.SM.selectFirstRow, this.SM, true);
this.DM.addListener('load', this.SM.selectFirstRow, this.SM, true);
this.DM.addListener('cellupdated', this.onAfterEdit, this );
When the user tries to enter some date using DatePicker, I get the error:
Date.monthNames[...] is null or not an object. Am I doing something wrong?
Hers's the code snippet:
var formatDate = function(value){
if ( value != "Invalid Date" && value != '' && !isNaN(value)) {
var tmpDate = new Date(Date.parse(value));
return tmpDate.dateFormat('M d, Y');
} else {
return;
}
};
var parseDate = function(value){
if ( value != null && value != "" && value != undefined) {
return new Date(Date.parse(value));
} else {
return;
}
};
CM = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ID", width: 75, sortable: true},
{header: "Store#*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "Est Ready Date", width: 75, sortable: true,renderer: formatDate,editor: new yg.DateEditor({allowBlank:true, format:'M d, Y'})},
{header: "Act Ready Date", width: 75, sortable: true,renderer: formatDate,editor: new yg.DateEditor({allowBlank:true, format:'M d, Y'})},
{header: "Name*", width: 75, sortable: true,editor: new yg.TextEditor()},
{header: "Status*", width: 75, sortable: true,editor: new yg.TextEditor(),renderer:formatStatus,editor: new yg.SelectEditor('status')},
{header: "Address*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "City*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "State*", width: 100, sortable: true,editor: new yg.TextEditor()},
{header: "Chain*", width: 100, sortable: true,editor: new yg.TextEditor(),renderer:formatChain,editor: new yg.SelectEditor('chain')},
{header: "Division*", width: 100, sortable: true,editor: new yg.TextEditor(),renderer:formatDivision,editor: new yg.SelectEditor('division')}
]);
var schema = {
tagName: 'site_browser',
id: 'use-index',
fields: this.arrCols
};
this.DM = new YAHOO.ext.grid.XMLDataModel(schema);
this.DM.setDefaultSort(CM, 0, "ASC");
this.DM.addPreprocessor(2, parseDate);
this.DM.addPreprocessor(3, parseDate);
this.DM.addListener('load', this.SM.selectFirstRow, this.SM, true);
this.DM.addListener('load', this.SM.selectFirstRow, this.SM, true);
this.DM.addListener('cellupdated', this.onAfterEdit, this );