diff options
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/table.js | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js index c154844820..a253917b61 100644 --- a/bitbake/lib/toaster/toastergui/static/js/table.js +++ b/bitbake/lib/toaster/toastergui/static/js/table.js | |||
| @@ -488,20 +488,6 @@ function tableInit(ctx){ | |||
| 488 | action.find('[data-date-to-for]').datepicker(options); | 488 | action.find('[data-date-to-for]').datepicker(options); |
| 489 | inputTo.val(selectedTo); | 489 | inputTo.val(selectedTo); |
| 490 | 490 | ||
| 491 | // if the radio button is checked and one or both of the datepickers are | ||
| 492 | // empty, populate them with today's date | ||
| 493 | radio.change(function () { | ||
| 494 | var now = new Date(); | ||
| 495 | |||
| 496 | if (inputFrom.val() === '') { | ||
| 497 | inputFrom.datepicker('setDate', now); | ||
| 498 | } | ||
| 499 | |||
| 500 | if (inputTo.val() === '') { | ||
| 501 | inputTo.datepicker('setDate', now); | ||
| 502 | } | ||
| 503 | }); | ||
| 504 | |||
| 505 | // set filter_value based on date pickers when | 491 | // set filter_value based on date pickers when |
| 506 | // one of their values changes | 492 | // one of their values changes |
| 507 | var changeHandler = function () { | 493 | var changeHandler = function () { |
| @@ -529,6 +515,24 @@ function tableInit(ctx){ | |||
| 529 | inputFrom.datepicker('option', 'maxDate', inputTo.val()); | 515 | inputFrom.datepicker('option', 'maxDate', inputTo.val()); |
| 530 | }); | 516 | }); |
| 531 | 517 | ||
| 518 | // if the radio button is checked and one or both of the datepickers are | ||
| 519 | // empty, populate them with today's date | ||
| 520 | radio.change(function () { | ||
| 521 | var now = new Date(); | ||
| 522 | |||
| 523 | if (inputFrom.val() === '') { | ||
| 524 | inputFrom.datepicker('setDate', now); | ||
| 525 | } | ||
| 526 | |||
| 527 | if (inputTo.val() === '') { | ||
| 528 | inputTo.datepicker('setDate', now); | ||
| 529 | } | ||
| 530 | |||
| 531 | // setting the date like this doesn't fire the changeHandler to | ||
| 532 | // update the filter_value, so do that manually instead | ||
| 533 | changeHandler() | ||
| 534 | }); | ||
| 535 | |||
| 532 | return action; | 536 | return action; |
| 533 | } | 537 | } |
| 534 | 538 | ||
