datepicker add year increase / decrease, #44.

This commit is contained in:
Miroslav Šedivý 2023-01-24 18:18:36 +01:00
parent f17219d054
commit d25b53ab33
3 changed files with 23 additions and 3 deletions

View File

@ -51,9 +51,11 @@ var datepick = function(container) {
var thead = $(
'<thead>' +
'<tr>' +
'<th><button type="button" class="button blue prev_y" title="Previous Year">&lt;&lt;</button></th>' +
'<th><button type="button" class="button blue prev" title="Previous Month">&lt;</button></th>' +
'<th class="month-pick" colspan="5" title="Select Month">'+this.months[this.m]+' '+this.y+'</th>' +
'<th class="month-pick" colspan="3" title="Select Month">'+this.months[this.m]+' '+this.y+'</th>' +
'<th><button type="button" class="button blue next" title="Next Month">&gt;</button></th>' +
'<th><button type="button" class="button blue next_y" title="Next Year">&gt;&gt;</button></th>' +
'</tr>' +
'<tr>' +
'<th>Mo</th>' +
@ -68,12 +70,22 @@ var datepick = function(container) {
);
var x = this;
$(thead).find(".prev_y").click(function(){
x.dec_y();
x.load_table();
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
});
$(thead).find(".prev").click(function(){
x.dec_m();
x.load_table();
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
});
$(thead).find(".next_y").click(function(){
x.inc_y();
x.load_table();
$(thead).find(".month-pick").text(x.months[x.m]+' '+x.y);
});
$(thead).find(".next").click(function(){
x.inc_m();
x.load_table();

View File

@ -1055,7 +1055,8 @@ code {
text-align: center;
}
.datepicker table {
display: inline-block;
width: 100%;
margin: 5px 0;
}
.datepicker th,
@ -1063,6 +1064,9 @@ code {
width: 12.5%;
}
.datepicker th {
padding: 5px 0;
}
.datepicker td {
color: #999;
padding: 5px;

View File

@ -1173,7 +1173,8 @@ code {
text-align: center;
}
.datepicker table {
display: inline-block;
width: 100%;
margin: 5px 0;
}
.datepicker th,
@ -1181,6 +1182,9 @@ code {
width: 12.5%;
}
.datepicker th {
padding: 5px 0;
}
.datepicker td {
color: var(--datepicker-inactive-month);
padding: 5px;