jquery - PickMeUp date picker - disable array of dates -


i using pickmeup datepicker selecting multiple dates. able pass array of dates, disable these dates , display them in different colour.

i have following code:

$('.multiple').pickmeup('clear'); $('.multiple').pickmeup({     flat: true,     mode: 'multiple' }); 

if knows how this, highly appreciate it.

what need load dates array. can check array pickmeup's object render event , check every date against dates array. if of dates coincide, return object disabled: true , user won't able select dates.

additionally, return class disabled improve disabled dates' css colors. because pickmeup's default color-scheme disabled dates black; makes hard see them.

the following javascript/jquery achieves want:

// creating 'sample' dates  var datesarray = []; var d = new date(); (i = 2; < 7; i++) {     var tempday = new date(); tempday.sethours(0,0,0,0);     tempday.setdate(d.getdate()+i);     datesarray.push(tempday.gettime()); }  $(function () {     $('.multiple').pickmeup({         flat: true,         mode: 'multiple',         // before rendering each date, deselect dates if in array         render: function(date) {             if ($.inarray(date.gettime(), datesarray) > -1){                 return {                     disabled   : true,                     class_name : 'disabled'                 }             }         }     }); }); // little hack deselect current day: pickmeup forces have default date :( $('.pmu-today').click(); 

with following css:

.disabled {     color: #5c5c8a !important;     background: #000033; } 

demo


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -