diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-01-15 13:00:57 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-15 16:30:00 +0000 |
commit | fcb20f9dfd076f7d35f2a1b7b6767eb4033897c2 (patch) | |
tree | 51b8ea99ea6883e2a428b84ae1b8e598a4fc881a | |
parent | f9c46f5e5e68229454b28adfe1a793d6b75f3096 (diff) | |
download | poky-fcb20f9dfd076f7d35f2a1b7b6767eb4033897c2.tar.gz |
bitbake: toastergui: ensure filter_value updates
Clicking on the radio button for a date range filter action
populates the from and to fields for that action if they are empty.
However, because this doesn't fire "change" events, clicking on
the radio button doesn't update the filter_value hidden field. This
means that the date range action's filter_value parameter isn't
set correctly when the filter popup is submitted.
Manually call the changeHandler() to set the filter_value whenever
the radio for a date range filter is clicked.
[YOCTO #8738]
(Bitbake rev: 1a3038cf8d9b32532f1fe92cd3472b4473ffc0c4)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 | ||