I tried to insert a datepicker field instead of <input type="month"/> inside a jQuery DataTable cell. However it is not working. I tried different methods but the calendar never showed up and the chrome editor console didn't show any errors. However the current solution it shows:
Uncaught TypeError: Cannot read property 'left' of undefined
Datepicker.place @ bootstrap-datepicker.js:609
Datepicker.show @ bootstrap-datepicker.js:420
b.extend.proxy.b.isFunction.i @ jquery-1.9.1.min.js:3
b.event.dispatch @ jquery-1.9.1.min.js:3
b.event.add.v.handle @ jquery-1.9.1.min.js:3
The code inside the DataTable is:
{
className: '',
orderable: false,
data: function (row, type, set, meta) {
return '<div class="input-append date">'+
'<input type="text" class="form-control" value="{{Carbon\Carbon::now()->format('m-Y')}}">'+
'<span class="add-on" id="datepick" ><i class="fa fa-calendar"></i></span>'+
'</div>'
}
},
And the javascript to initialize the datepicker:
$(document).ready('.input-append .date').datepicker({
format: "M/yyyy",
minViewMode: 1,
multidate: true,
autoclose: true,
beforeShowMonth: function (date){
switch (date.getMonth()){
case 8:
return false;
}
},
toggleActive: true
});
$('#datepick').click(function () {
$(this).next().datepicker('show');
});
Any help or hints is appreciated.
.input-appendand.datea typo in your question, or is that in your code?