Closed jtsage closed 5 years ago
Ok. bit of an update.
calFormatter is a function that gets a single argument of the display object. in it is:
{
// the theme class to be applied to the date
theme : [String]
// The date is in the current month displayed.
inBounds : [boolean]
// True if the date is valid
good : [boolean],
// True if the date is invalid
bad : [boolean],
// Set to the rule that failed the date, or false
failrule : [boolean|String],
// Set to the rule that passed the date, or false.
// Note: both failrule and passrule may be empty if the date passed by default (not explicitly)
passrule : [boolean|String],
// The current date being processed.
dateObj : [JavaScript Date Object]
}
[x] Option 1 : a string to stuff into the the framework defined HTML for this element. This can contain inline HTML.
[ ] ~Option 2 : a string to replace the framework defined HTML for this element.~ Rejected: this is what calBeforeAppendFunc is for. With the bonus that you can alter the already created HTML element.
var firstGridDate = this.getCalStartGrid();
var lastGridDate = this.getCalEndGrid();
// These are identical. Note the copy, as it is a *mutable* object.
var userSelectedDate = this.originalDate.copy();
var userSelectedDate = this.getSelectedDate();
// These are identical. Note the copy, as it is a *mutable* object.
var workingDate = this.theDate.copy();
var workingDate = this.getTheDate();
var isSelectedVisible = this.isSelectedInCalGrid();
Also changed the context of calBeforeAppendFunc() to be the widget as well, so the same rules of running datebox functions inside that callback apply.
Looking at #356, there is a fair bit of intended functionality. Most of it works. document it.
Things that should be in the passed object:
What should be returned?
Option 1 : a string to stuff into the the framework defined HTML for this element. innerHTML probably, we should allow for "inline" HTML. (this makes knowing the theme somewhat
Option 2 : a string to replace the framework defined HTML for this element. (more dangerous option, but should be possible)
What scope?
This currently runs detached, but it would probably make life way easier if it ran in the context of the widget, you could do:
rather than