calBeforeAppendFunc
Control formatting of the calbox grid box
This option allows you to define a custom function that is called on the generated calbox grid box of each date.
It provides a jQuery object, it expects you to return a jQuery object.
The provided object (in a single argument), is the generated, complete jQuery object for the date box, which also has the following data pre-defined:
{
date: ##, // Numeric Date
enabled: true, // Date can be selected
month: ##, // Numeric Month, zero based
}
Example function:
window.printData = function( myObject ) {
console.log( myObject.data() );
return myObject;
}
Then, to link it to datebox, it could be as easy as:
<input type="text" data-role="datebox" data-datebox-mode="calbox" data-datebox-calBeforeAppendFunc="printData">
Dynamically changing the function:
Admittedly, the function below is probably even more useless than the first one, but it demonstrates the principle:
$('#datebox_input_element').datebox({ 'calBeforeAppendFunc': function( myObject ) { return myObject; } });
Data Type Expected
Function
Default Vaule
function (t) { return t; }
Option is Dynamic Post Initialization
True