Browse Source

Fixed bug 1318

Fixed bug https://github.com/wenzhixin/bootstrap-table/issues/1318 with solution proposed by @SimaoLiu in https://github.com/wenzhixin/bootstrap-table/issues/1313
Aaron Cowdrey 10 years ago
parent
commit
6c77c5a1c1
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

+ 5 - 1
src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

@@ -95,11 +95,13 @@
             clickDelay:200,
             beforeStop: function() {
                 var ths = [],
+                    formatters = [],
                     columns = [],
                     columnsHidden = [],
                     columnIndex = -1;
                 that.$header.find('th').each(function (i) {
                     ths.push($(this).data('field'));
+                    formatters.push($(this).data('formatter'));
                 });
 
                 //Exist columns not shown
@@ -109,6 +111,7 @@
                     });
                     for (var i = 0; i < columnsHidden.length; i++) {
                         ths.push(columnsHidden[i].field);
+                        formatters.push(columnsHidden[i].formatter);
                     }
                 }
 
@@ -122,9 +125,10 @@
 
                 that.columns = that.columns.concat(columns);
                 that.header.fields = ths;
+                that.header.formatters = formatters;
                 that.resetView();
                 that.trigger('reorder-column', ths);
             }
         });
     };
-}(jQuery);
+}(jQuery);