]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Fix the `eachDay` option
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 11 Sep 2013 16:19:27 +0000 (18:19 +0200)
committerScott González <scott.gonzalez@gmail.com>
Thu, 29 Jan 2015 22:47:46 +0000 (17:47 -0500)
Use the `eachDay` option in the other-months demo.
Fix handling of `extraClasses` property, split on space.

demos/datepicker/other-months.html
external/date.js
ui/datepicker.js

index bad2b1977fab6e1b6aff976dcceedc48939ca36a..bfb3f1af36f8b8c5ebbec7bbe6c0a0a1977640ec 100644 (file)
        <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>
index 23efeef708d2e132575b863903892def8c3514df..fef4dcaeffe6f120e7fb31efc9084841bb3d9d2f 100644 (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 );
                                }
index f1b9dc6c01cb656b4458396c70732183c187d313..625991d8842883d0934cac634d4d4920c4744355 100644 (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( "" ) + "'>" +