[Kimchi-devel] [PATCH] Bug Fix: Correct select menu to handle empty input

Yu Xin Huo huoyuxin at linux.vnet.ibm.com
Tue Sep 23 11:03:28 UTC 2014


This is the same patch as my 1st "[PATCH] Bug 440 Fix", but I changed 
the title.
No matter finally how 440 will be resolved, part of that issue is pure 
from select menu widget which handles empty option incorrectly.
There are many places using select widget which will all suffer from 
this issue, so it worth a separate fix.

On 9/23/2014 6:48 PM, huoyuxin at linux.vnet.ibm.com wrote:
> From: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
>
> Signed-off-by: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
> ---
>   ui/js/widgets/select-menu.js |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js
> index ad53200..c4b0209 100644
> --- a/ui/js/widgets/select-menu.js
> +++ b/ui/js/widgets/select-menu.js
> @@ -36,8 +36,10 @@
>               var selectedClass = 'active';
>               var itemTag = 'li';
>               var item;
> +            that.listControl.find('li').remove();
> +            that.label.text("");
> +            that.target.val("");
>               if (options.length > 0) {
> -                that.listControl.find('li').remove();
>                   $.each(options, function(index, option) {
>                       item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>');
>                       item.data('value', option.value);
> @@ -58,8 +60,6 @@
>                           that.target.change();
>                       }
>                   });
> -            } else {
> -                kimchi.message.error.code('KCHAPI6006E');
>               }
>           },
>





More information about the Kimchi-devel mailing list