[Kimchi-devel] [PATCHv3 1/3] Fix select menu data append

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Apr 29 06:53:38 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Select menu appended data to list,
this results in items accumulating when everytime try to set data.
Fix it by clear list before appending.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 ui/js/widgets/select-menu.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/js/widgets/select-menu.js b/ui/js/widgets/select-menu.js
index 237797d..46367f2 100644
--- a/ui/js/widgets/select-menu.js
+++ b/ui/js/widgets/select-menu.js
@@ -26,7 +26,6 @@
             this.label = this.selectDiv.find('span').first();
             this.selectDiv.addClass('btn dropdown popable');
             this.target.addClass('input');
-            this.label.addClass('input');
             this.listControl.addClass('select-list');
             this.listControl.parent().addClass('popover');
         },
@@ -38,6 +37,7 @@
             var itemTag = 'li';
             var item;
             if (options.length > 0) {
+                that.listControl.find('li').remove();
                 $.each(options, function(index, option) {
                     item = $('<' + itemTag + '>' + option.label +'</' + itemTag + '>');
                     item.data('value', option.value);
@@ -59,7 +59,7 @@
                     }
                 });
             } else {
-                kimchi.message.code.error('KCHAPI6006E');
+                kimchi.message.error.code('KCHAPI6006E');
             }
         },
 
-- 
1.8.3.2




More information about the Kimchi-devel mailing list