HandsOnTable - using date functions with methods
- by briansol
I have a function used on the datepicker to limit dates selected to the first of the month... I invoke it by setting a class and listener, such as:
$( ".datepickfom" ).datepicker(
{
beforeShowDay: fom,
showOn: "both",
buttonImage: "/images/calendar.png",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: "m/d/yy",
yearRange: "-25:+100",
constrainInput: true
}
);
the fom call:
function fom(date){
if (date.getDate() != 1) {
return [false, "", "Specify 1st of Month"];
}
return [true, ""];
}
This works great for regular forms.
I'm looking to extend this functionality to the HandsOnTable 'date' cell data types.
var $container_1 = $("#datatable_1");
var handsontable_1 = $container_1.data('handsontable');
$("#datatable_1").handsontable(
{ columns: [
{},
{},
{
type: 'date',
dateFormat: 'm/d/yy'
},
{},
{
type: 'dropdown',
source: ["","Y","N"]
},
{},
{}
]
});
This also works as it should, but the date lets me pick other dates besides the first.
Is there a way to attach the
beforeShowDay
option to the HOT cell call as well?