Browse Source

修复select2级联选择bug

zhouchenglin 6 năm trước cách đây
mục cha
commit
83b73d2262
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/main/webapp/static/js/common.js

+ 4 - 0
src/main/webapp/static/js/common.js

@@ -484,6 +484,10 @@ $.fn.selectBindEx = function(opt) {
         url: option.url,
         data: null,
         success: function(r) {
+            if ($select.hasClass("select2-hidden-accessible")) {
+                $select.empty();
+                $select.select2('destroy');
+            }
             selectControl = $select.select2(option);
             $.each(r, function(idx, item){
                 selectControl.append("<option value='"+item[option.value]+"'>"+item[option.text]+"</option>");