4xy
4xy

Reputation: 3662

Bootstrap date paginator enable datepicker

I use Bootstrap date paginator. I really can't figure out by myself how to enable datepicker to allow select a date. Calendar is shown but the date selection is disabled.enter image description here

The initialization code is.

var options = {
    selectedDate: $('#selected-date').html(),
    selectedDateFormat: 'YYYYMMDD',
    onSelectedDateChanged: function (event, date) {
        $('#selected-date').html(moment(date).format('YYYYMMDD'));
        disableDatePaginator();
        $('#log-table').DataTable().ajax.reload(function(json){ enableDatePaginator(); });
    },
};
$('#date-paginator').datepaginator(options);

I tried $('#date-paginator').datepaginator(options).datepicker(); with no success.

Upvotes: 2

Views: 804

Answers (1)

4xy
4xy

Reputation: 3662

Finally I found the reason of the issue. It's necessary to specify valid startDate and endDate in options for date paginator like this.

var options = {
    startDate: moment(new Date(2000, 1, 1)),
    endDate: moment(new Date(2100, 1, 1)),
    selectedDate: $('#selected-date').html(),
    selectedDateFormat: '{{date_format}}',
    onSelectedDateChanged: function (event, date) {
        $('#selected-date').html(moment(date).format('{{date_format}}'));
        disableDatePaginator();
        $('#log-table').DataTable().ajax.reload(function(json){ enableDatePaginator(); });
    },
};

Upvotes: 1

Related Questions