浏览代码

Added the logic to show

the column invible at the end
Dennis Hernández 10 年之前
父节点
当前提交
9a5cf52d2e
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

+ 11 - 0
src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

@@ -96,11 +96,22 @@
             beforeStop: function() {
                 var ths = [],
                     columns = [],
+                    columnsHidden = [],
                     columnIndex = -1;
                 that.$header.find('th').each(function (i) {
                     ths.push($(this).data('field'));
                 });
 
+                //Exist columns not shown
+                if (ths.length < that.options.columns.length) {
+                    columnsHidden = $.grep(that.options.columns, function (column) {
+                       return !column.visible;
+                    });
+                    for (var i = 0; i < columnsHidden.length; i++) {
+                        ths.push(columnsHidden[i].field);
+                    }
+                }
+
                 for (var i = 0; i < ths.length; i++ ) {
                     columnIndex = getFieldIndex(that.options.columns, ths[i]);
                     if (columnIndex !== -1) {