Datepicker: Fix the eachDay option

Use the `eachDay` option in the other-months demo.
Fix handling of `extraClasses` property, split on space.
This commit is contained in:
Jörn Zaefferer 2013-09-11 18:19:27 +02:00 committed by Scott González
parent e50d6d3bd2
commit 9ec69ccb73
3 changed files with 12 additions and 6 deletions

View File

@ -17,8 +17,13 @@
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOtherMonths: true,
selectOtherMonths: true
eachDay: function( day ) {
if ( day.lead ) {
day.render = true;
day.selectable = true;
day.extraClasses = "ui-priority-secondary";
}
}
});
});
</script>

5
external/date.js vendored
View File

@ -130,8 +130,9 @@ $.date = function( datestring, formatstring ) {
today: today.equal( printDate )
};
day.render = day.selectable = !day.lead;
// TODO undefined in picker demos, fix it
// this.eachDay( day );
if ( this.eachDay ) {
this.eachDay( day );
}
// TODO use adjust("D", 1)?
printDate.setDate( printDate.getDate() + 1 );
}

View File

@ -476,7 +476,7 @@ $.widget( "ui.datepicker", {
classes.push( "ui-state-highlight" );
}
if ( day.extraClasses ) {
classes.push( day.extraClasses.split( "" ) );
classes.push( day.extraClasses.split( " " ) );
}
link = "<a href='#' tabindex='-1' data-timestamp='" + day.timestamp + "' class='" + classes.join( " " ) + "'>" +
@ -495,7 +495,7 @@ $.widget( "ui.datepicker", {
classes.push( "ui-state-highlight" );
}
if ( day.extraClasses ) {
classes.push( day.extraClasses.split( "" ) );
classes.push( day.extraClasses.split( " " ) );
}
return "<span class='" + classes.join( "" ) + "'>" +