Browse Source

列表显示修改

miaofuhao 6 years ago
parent
commit
a5ca63321e

+ 68 - 1
CallCenterWeb.UI/WorkOrder/WorkOrderDispose.html

@@ -77,6 +77,58 @@
77 77
 			.inps2,.inps3{
78 78
 				display: none;
79 79
 			}
80
+			.W50 .th-inner {
81
+			    width:50px !important;
82
+			}
83
+			.W60 .th-inner {
84
+			    width:60px !important;
85
+			}
86
+			.W60margin .th-inner {
87
+			    width:60px !important;
88
+			    margin-right: 220px !important;
89
+			}
90
+			.W60margin{
91
+			    width:60px !important;
92
+			    text-align: left !important;
93
+			}
94
+			.W80 .th-inner {
95
+			    width:80px !important;
96
+			}
97
+			.W90 .th-inner {
98
+			    width:90px !important;
99
+			}
100
+			.W100 .th-inner {
101
+			    width:100px !important;
102
+			}
103
+			.W120 .th-inner {
104
+			    width:120px !important;
105
+			}
106
+			.W150 .th-inner {
107
+			    width:150px !important;
108
+			}
109
+			.W160 .th-inner {
110
+			    width:160px !important;
111
+			}
112
+			.W170 .th-inner {
113
+			    width:170px !important;
114
+			}
115
+			.W220 .th-inner {
116
+			   width:220px !important;
117
+			   position: absolute;
118
+			   right: 0;
119
+			   top: 0;
120
+			   border-left: 1px solid #DDDDDD ;
121
+			   background: #F3F3F4;
122
+			   height: 39px;
123
+			   border-bottom: 1px solid #DDDDDD;
124
+			}
125
+			.W220{
126
+			   width:220px !important;
127
+			   position: absolute;
128
+			   right: 0;
129
+			   background: #F3F3F4;	
130
+			   border-bottom: 1px solid #DDDDDD;
131
+			}
80 132
 		</style>
81 133
 	</head>
82 134
 	<body class="gray-bg">
@@ -156,7 +208,7 @@
156 208
 			<div style="width: 100%;padding: 10px;" id="ce" class="customerService">
157 209
 				<table id="workorderlist" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
158 210
 					<thead>
159
-						<tr>
211
+						<tr style="position: relative;">
160 212
 							<th data-field="F_WorkOrderId" data-formatter="View" data-align="center">工单编号</th>
161 213
 							<th data-field="F_CreateTime" data-align="center">创建时间</th>
162 214
 							<th data-field="F_State" data-formatter="GetStateName" data-align="center">工单状态</th>
@@ -550,6 +602,7 @@
550 602
 
551 603
 			})
552 604
 
605
+
553 606
 			function initTable() {
554 607
 				//先销毁表格
555 608
 				$('#workorderlist').bootstrapTable('destroy');
@@ -566,6 +619,13 @@
566 619
 					search: false, //是否启用查询
567 620
 					showColumns: false, //显示下拉框勾选要显示的列
568 621
 					showRefresh: false, //显示刷新按钮
622
+					fixedColumns: true,
623
+                	fixedNumber: 14,
624
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
625
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
626
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
627
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
628
+                	,{class:'W60margin'},{class:'W220'}],
569 629
 					sidePagination: "server", //表示服务端请求
570 630
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
571 631
 					//设置为limit可以获取limit, offset, search, sort, order
@@ -614,6 +674,13 @@
614 674
 					search: false, //是否启用查询
615 675
 					showColumns: false, //显示下拉框勾选要显示的列
616 676
 					showRefresh: false, //显示刷新按钮
677
+					fixedColumns: true,
678
+                	fixedNumber: 14,
679
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
680
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
681
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
682
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
683
+                	,{class:'W60margin'},{class:'W220'}],
617 684
 					sidePagination: "server", //表示服务端请求
618 685
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
619 686
 					//设置为limit可以获取limit, offset, search, sort, order

+ 70 - 0
CallCenterWeb.UI/WorkOrder/WorkOrderParty.html

@@ -89,6 +89,62 @@
89 89
 			.inps2,.inps3{
90 90
 				display: none;
91 91
 			}
92
+			.W50 .th-inner {
93
+			    width:50px !important;
94
+			}
95
+			.W60 .th-inner {
96
+			    width:60px !important;
97
+			}
98
+			.W60margin .th-inner {
99
+			    width:60px !important;
100
+			    margin-right: 220px !important;
101
+			}
102
+			.W60margin{
103
+			    width:60px !important;
104
+			    text-align: left !important;
105
+			    
106
+			}
107
+			.W80 .th-inner {
108
+			    width:80px !important;
109
+			}
110
+			.W90 .th-inner {
111
+			    width:90px !important;
112
+			}
113
+			.W100 .th-inner {
114
+			    width:100px !important;
115
+			}
116
+			.W120 .th-inner {
117
+			    width:120px !important;
118
+			}
119
+			.W150 .th-inner {
120
+			    width:150px !important;
121
+			}
122
+			.W160 .th-inner {
123
+			    width:160px !important;
124
+			}
125
+			.W170 .th-inner {
126
+			    width:170px !important;
127
+			}
128
+			.W220 .th-inner {
129
+			   width:220px !important;
130
+			   position: absolute;
131
+			   right: 0;
132
+			   top: 0;
133
+			   border-left: 1px solid #DDDDDD ;
134
+			   background: #F3F3F4;
135
+			   height: 39px;
136
+			   border-bottom: 1px solid #DDDDDD;
137
+			}
138
+			.W220{
139
+			   width:220px !important;
140
+			   position: absolute;
141
+			   right: 0;
142
+			   background: #F3F3F4;	
143
+			   border-bottom: 1px solid #DDDDDD;
144
+			}
145
+			.RemoveC a{
146
+				margin-bottom: 0;
147
+			}
92 148
 		</style>
93 149
 
94 150
 	</head>
@@ -516,6 +572,13 @@
516 572
 					showColumns: false, //显示下拉框勾选要显示的列
517 573
 					showRefresh: false, //显示刷新按钮
518 574
 					sidePagination: "server", //表示服务端请求
575
+					fixedColumns: true,
576
+                	fixedNumber: 14,
577
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
578
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
579
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
580
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
581
+                	,{class:'W60margin'},{class:'W220'}],
519 582
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
520 583
 					//设置为limit可以获取limit, offset, search, sort, order
521 584
 					queryParamsType: "undefined",
@@ -575,6 +638,13 @@
575 638
 					showColumns: false, //显示下拉框勾选要显示的列
576 639
 					showRefresh: false, //显示刷新按钮
577 640
 					sidePagination: "server", //表示服务端请求
641
+					fixedColumns: true,
642
+                	fixedNumber: 14,
643
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
644
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
645
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
646
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
647
+                	,{class:'W60margin'},{class:'W220'}],
578 648
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
579 649
 					//设置为limit可以获取limit, offset, search, sort, order
580 650
 					queryParamsType: "undefined",

+ 66 - 0
CallCenterWeb.UI/WorkOrder/WorkOrderSearch.html

@@ -81,6 +81,58 @@
81 81
 			.inps2,.inps3{
82 82
 				display: none;
83 83
 			}
84
+			.W50 .th-inner {
85
+			    width:50px !important;
86
+			}
87
+			.W60 .th-inner {
88
+			    width:60px !important;
89
+			}
90
+			.W60margin .th-inner {
91
+			    width:60px !important;
92
+			    margin-right: 220px !important;
93
+			}
94
+			.W60margin{
95
+			    width:60px !important;
96
+			    text-align: left !important;
97
+			}
98
+			.W80 .th-inner {
99
+			    width:80px !important;
100
+			}
101
+			.W90 .th-inner {
102
+			    width:90px !important;
103
+			}
104
+			.W100 .th-inner {
105
+			    width:100px !important;
106
+			}
107
+			.W120 .th-inner {
108
+			    width:120px !important;
109
+			}
110
+			.W150 .th-inner {
111
+			    width:150px !important;
112
+			}
113
+			.W160 .th-inner {
114
+			    width:160px !important;
115
+			}
116
+			.W170 .th-inner {
117
+			    width:170px !important;
118
+			}
119
+			.W220 .th-inner {
120
+			   width:220px !important;
121
+			   position: absolute;
122
+			   right: 0;
123
+			   top: 0;
124
+			   border-left: 1px solid #E7EAEC ;
125
+			   background: #F3F3F4;
126
+			   height: 39px;
127
+			   border-bottom: 1px solid #E7EAEC;
128
+			}
129
+			.W220{
130
+			   width:220px !important;
131
+			   position: absolute;
132
+			   right: 0;
133
+			   background: #F3F3F4;	
134
+			   border-bottom: 1px solid #DDDDDD;
135
+			}
84 136
 		</style>
85 137
 
86 138
 	</head>
@@ -413,6 +465,13 @@
413 465
 					showColumns: false, //显示下拉框勾选要显示的列
414 466
 					showRefresh: false, //显示刷新按钮
415 467
 					sidePagination: "server", //表示服务端请求
468
+					fixedColumns: true,
469
+                	fixedNumber: 14,
470
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
471
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
472
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
473
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
474
+                	,{class:'W60margin'},{class:'W220'}],
416 475
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
417 476
 					//设置为limit可以获取limit, offset, search, sort, order
418 477
 					queryParamsType: "undefined",
@@ -460,6 +519,13 @@
460 519
 					showColumns: false, //显示下拉框勾选要显示的列
461 520
 					showRefresh: false, //显示刷新按钮
462 521
 					sidePagination: "server", //表示服务端请求
522
+					fixedColumns: true,
523
+                	fixedNumber: 14,
524
+                	columns:[{class:'W120'},{class:'W160'},{class:'W80'}
525
+                	,{class:'W60'},{class:'W60'},{class:'W80'}
526
+                	,{class:'W170'},{class:'W80'},{class:'W120'}
527
+                	,{class:'W80'},{class:'W90'},{class:'W90'}
528
+                	,{class:'W60margin'},{class:'W220'}],
463 529
 					//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
464 530
 					//设置为limit可以获取limit, offset, search, sort, order
465 531
 					queryParamsType: "undefined",

+ 242 - 0
CallCenterWeb.UI/css/bootstrap-table-fixed-columns.js

@@ -0,0 +1,242 @@
1
+/**
2
+ * @author zhixin wen <wenzhixin2010@gmail.com>
3
+ * @version: v1.0.1
4
+ * Modificated 16.08.16 by Aleksej Tokarev (Loecha)
5
+ *  - Sorting Problem solved
6
+ *  - Recalculated Size of fixed Columns
7
+ */
8
+
9
+(function ($) {
10
+    'use strict';
11
+
12
+    $.extend($.fn.bootstrapTable.defaults, {
13
+        fixedColumns: false,
14
+        fixedNumber: 1
15
+    });
16
+
17
+    var BootstrapTable  = $.fn.bootstrapTable.Constructor,
18
+        _initHeader     = BootstrapTable.prototype.initHeader,
19
+        _initBody       = BootstrapTable.prototype.initBody,
20
+        _resetView      = BootstrapTable.prototype.resetView,
21
+        _getCaret       = BootstrapTable.prototype.getCaret;  // Add: Aleksej
22
+
23
+    BootstrapTable.prototype.initFixedColumns = function () {
24
+        this.$fixedHeader = $([
25
+            '<div class="fixed-table-header-columns">',
26
+            '<table>',
27
+            '<thead></thead>',
28
+            '</table>',
29
+            '</div>'].join(''));
30
+
31
+        this.timeoutHeaderColumns_ = 0;
32
+        this.$fixedHeader.find('table').attr('class', this.$el.attr('class'));
33
+        this.$fixedHeaderColumns = this.$fixedHeader.find('thead');
34
+        this.$tableHeader.before(this.$fixedHeader);
35
+
36
+        this.$fixedBody = $([
37
+            '<div class="fixed-table-body-columns">',
38
+            '<table>',
39
+            '<tbody></tbody>',
40
+            '</table>',
41
+            '</div>'].join(''));
42
+
43
+        this.timeoutBodyColumns_ = 0;
44
+        this.$fixedBody.find('table').attr('class', this.$el.attr('class'));
45
+        this.$fixedBodyColumns = this.$fixedBody.find('tbody');
46
+        this.$tableBody.before(this.$fixedBody);
47
+    };
48
+
49
+    BootstrapTable.prototype.initHeader = function () {
50
+        _initHeader.apply(this, Array.prototype.slice.apply(arguments));
51
+
52
+        if (!this.options.fixedColumns) {
53
+            return;
54
+        }
55
+
56
+        this.initFixedColumns();
57
+
58
+        var that = this, $trs = this.$header.find('tr').clone(true); //Fix: Aleksej "clone()" mit "clone(true)" ersetzt
59
+        $trs.each(function () {
60
+            // This causes layout problems:
61
+            //$(this).find('th:gt(' + (that.options.fixedNumber -1) + ')').remove(); // Fix: Aleksej "-1" hinnzugefügt. Denn immer eine Spalte Mehr geblieben ist
62
+            $(this).find('th:gt(' + that.options.fixedNumber + ')').remove();
63
+        });
64
+        this.$fixedHeaderColumns.html('').append($trs); 
65
+    };
66
+
67
+    BootstrapTable.prototype.initBody = function () {
68
+        _initBody.apply(this, Array.prototype.slice.apply(arguments));
69
+
70
+        if (!this.options.fixedColumns) {
71
+            return;
72
+        }
73
+
74
+        var that = this,
75
+            rowspan = 0;
76
+
77
+        this.$fixedBodyColumns.html('');
78
+        this.$body.find('> tr[data-index]').each(function () {
79
+            var $tr = $(this).clone(),
80
+                $tds = $tr.find('td');
81
+
82
+            var dataIndex = $tr.attr("data-index");
83
+            $tr = $("<tr></tr>");
84
+            $tr.attr("data-index", dataIndex);
85
+
86
+            var end = that.options.fixedNumber;
87
+            if (rowspan > 0) {
88
+                --end;
89
+                --rowspan;
90
+            }
91
+            for (var i = 0; i < end; i++) {
92
+                $tr.append($tds.eq(i).clone());
93
+            }
94
+            that.$fixedBodyColumns.append($tr);
95
+            
96
+            if ($tds.eq(0).attr('rowspan')){
97
+                rowspan = $tds.eq(0).attr('rowspan') - 1;
98
+            }
99
+        });
100
+    };
101
+
102
+    BootstrapTable.prototype.resetView = function () {
103
+        _resetView.apply(this, Array.prototype.slice.apply(arguments));
104
+
105
+        if (!this.options.fixedColumns) {
106
+            return;
107
+        }
108
+
109
+        clearTimeout(this.timeoutHeaderColumns_);
110
+        this.timeoutHeaderColumns_ = setTimeout($.proxy(this.fitHeaderColumns, this), this.$el.is(':hidden') ? 100 : 0);
111
+
112
+        clearTimeout(this.timeoutBodyColumns_);
113
+        this.timeoutBodyColumns_ = setTimeout($.proxy(this.fitBodyColumns, this), this.$el.is(':hidden') ? 100 : 0);
114
+    };
115
+
116
+    BootstrapTable.prototype.fitHeaderColumns = function () {
117
+        var that = this,
118
+            visibleFields = this.getVisibleFields(),
119
+            headerWidth = 0;
120
+
121
+        this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
122
+            var $this = $(this),
123
+                index = i;
124
+
125
+            if (i >= that.options.fixedNumber) {
126
+                return false;
127
+            }
128
+
129
+            if (that.options.detailView && !that.options.cardView) {
130
+                index = i - 1;
131
+            }
132
+
133
+            var $th = that.$fixedHeader.find('th[data-field="' + visibleFields[index] + '"]');
134
+            $th.find('.fht-cell').width($this.innerWidth());
135
+            headerWidth += $this.outerWidth();
136
+
137
+            $th.data('fix-pos', index);
138
+        });
139
+        this.$fixedHeader.width(headerWidth + 1).show();
140
+
141
+        // fix click event
142
+        this.$fixedHeader.delegate("tr th", 'click', function() {
143
+            $(this).parents(".fixed-table-container").find(".fixed-table-body table thead tr th:eq("+$(this).data("fix-pos")+") .sortable").click();
144
+        })
145
+    };
146
+
147
+    /**
148
+    * Add: Aleksej
149
+    * Hook für getCaret. Aktualisieren Header bei Fixed-Columns wenn diese sortiert wurden
150
+    * @method getCaret
151
+    * @for BootstrapTable
152
+    */
153
+    BootstrapTable.prototype.getCaret = function () {
154
+        var result = _getCaret.apply(this, arguments);
155
+
156
+        if (this.options.fixedColumns && this.$fixedHeaderColumns instanceof jQuery) {
157
+            var that = this, $th;
158
+
159
+            $.each(this.$fixedHeaderColumns.find('th'), function (i, th) {
160
+                $th = $(th);
161
+                $th.find('.sortable').removeClass('desc asc').addClass($th.data('field') === that.options.sortName ? that.options.sortOrder : 'both');
162
+            });
163
+        }
164
+
165
+     return result;
166
+    };
167
+
168
+    /**
169
+     * Add: Aleksej, zum berechnen von Scrollbar-Größe
170
+     * @method calcScrollBarSize
171
+     * @return Number
172
+     */
173
+    BootstrapTable.prototype.calcScrollBarSize = function () {
174
+        // Es ist egal, ob Höhe oder Breite
175
+        var tmpWidth        = 100,
176
+            $container      = $('<div>').css({
177
+                width       : tmpWidth, 
178
+                overflow    : 'scroll', 
179
+                visibility  : 'hidden'}
180
+            ).appendTo('body'),
181
+            widthWithScroll = $('<div>').css({
182
+                width: '100%'
183
+            }).appendTo($container).outerWidth();
184
+
185
+        $container.remove();
186
+        return tmpWidth - widthWithScroll;
187
+    };
188
+
189
+    BootstrapTable.prototype.fitBodyColumns = function () {
190
+        var that            = this,
191
+            borderHeight    = (parseInt(this.$el.css('border-bottom-width')) + parseInt(this.$el.css('border-top-width'))), // Add. Aleksej
192
+            top             = this.$fixedHeader.outerHeight() + borderHeight, // Fix. Aleksej "-2" mit "+ borderHeight" ersetzt
193
+            // the fixed height should reduce the scorll-x height
194
+            height          = this.$tableBody.height() - this.calcScrollBarSize(); // Fix. Aleksej "-14" mit "- this.calcScrollBarSize()" ersetzt
195
+            
196
+        if (!this.$body.find('> tr[data-index]').length) {
197
+            this.$fixedBody.hide();
198
+            return;
199
+        }
200
+
201
+        if (!this.options.height) {
202
+            top = this.$fixedHeader.height();
203
+            height = height - top;
204
+        }
205
+
206
+        this.$fixedBody.css({
207
+            width: this.$fixedHeader.width(),
208
+            height: height,
209
+            top: top
210
+        }).show();
211
+
212
+        this.$body.find('> tr').each(function (i) {
213
+            that.$fixedBody.find('tr:eq(' + i + ')').height($(this).height() - 1);
214
+        });
215
+
216
+        // events
217
+        this.$tableBody.on('scroll', function () {
218
+            that.$fixedBody.find('table').css('top', -$(this).scrollTop());
219
+        });
220
+        this.$body.find('> tr[data-index]').off('hover').hover(function () {
221
+            var index = $(this).data('index');
222
+            that.$fixedBody.find('tr[data-index="' + index + '"]').addClass('hover');
223
+        }, function () {
224
+            var index = $(this).data('index');
225
+            that.$fixedBody.find('tr[data-index="' + index + '"]').removeClass('hover');
226
+        });
227
+        this.$fixedBody.find('tr[data-index]').off('hover').hover(function () {
228
+            var index = $(this).data('index');
229
+            that.$body.find('tr[data-index="' + index + '"]').addClass('hover');
230
+        }, function () {
231
+            var index = $(this).data('index');
232
+            that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover');
233
+        });
234
+
235
+        // fix td width bug
236
+        var $first_tr = that.$body.find('tr:eq(0)');
237
+        that.$fixedBody.find('tr:eq(0)').find("td").each(function(index) {
238
+            $(this).width($first_tr.find("td:eq("+index+")").width())
239
+        });
240
+    };
241
+
242
+})(jQuery);

+ 0 - 1
CallCenterWeb.UI/js/WorkOrder/WorkOrder.js

@@ -284,7 +284,6 @@ function View(val, row) {
284 284
 	return '<div class="imgs" ><a class="xg" index="' + row.CreateUser + '" onclick= ck("' + val + '") >' + val + '</a></div>';
285 285
 	$("#F_UserCode").val(row.CreateUser);
286 286
 }
287
-
288 287
 function forMaterDepart(val, row) {
289 288
 	var str = "";
290 289
 	if(val == '' || val == null) {

+ 127 - 30
CallCenterWeb.UI/js/bootstrap-table-fixed-columns.js

@@ -1,3 +1,11 @@
1
+/**
2
+ * @author zhixin wen <wenzhixin2010@gmail.com>
3
+ * @version: v1.0.1
4
+ * Modificated 16.08.16 by Aleksej Tokarev (Loecha)
5
+ *  - Sorting Problem solved
6
+ *  - Recalculated Size of fixed Columns
7
+ */
8
+
1 9
 (function ($) {
2 10
     'use strict';
3 11
 
@@ -6,24 +14,34 @@
6 14
         fixedNumber: 1
7 15
     });
8 16
 
9
-    var BootstrapTable = $.fn.bootstrapTable.Constructor,
10
-        _initHeader = BootstrapTable.prototype.initHeader,
11
-        _initBody = BootstrapTable.prototype.initBody,
12
-        _resetView = BootstrapTable.prototype.resetView;
17
+    var BootstrapTable  = $.fn.bootstrapTable.Constructor,
18
+        _initHeader     = BootstrapTable.prototype.initHeader,
19
+        _initBody       = BootstrapTable.prototype.initBody,
20
+        _resetView      = BootstrapTable.prototype.resetView,
21
+        _getCaret       = BootstrapTable.prototype.getCaret;  // Add: Aleksej
13 22
 
14 23
     BootstrapTable.prototype.initFixedColumns = function () {
15
-        this.$fixedBody = $([
16
-            '<div class="fixed-table-column" style="position: absolute; background-color: #fff; border-right:1px solid #ddd;">',
24
+        this.$fixedHeader = $([
25
+            '<div class="fixed-table-header-columns">',
17 26
             '<table>',
18 27
             '<thead></thead>',
19
-            '<tbody></tbody>',
20 28
             '</table>',
21 29
             '</div>'].join(''));
22 30
 
23 31
         this.timeoutHeaderColumns_ = 0;
32
+        this.$fixedHeader.find('table').attr('class', this.$el.attr('class'));
33
+        this.$fixedHeaderColumns = this.$fixedHeader.find('thead');
34
+        this.$tableHeader.before(this.$fixedHeader);
35
+
36
+        this.$fixedBody = $([
37
+            '<div class="fixed-table-body-columns">',
38
+            '<table>',
39
+            '<tbody></tbody>',
40
+            '</table>',
41
+            '</div>'].join(''));
42
+
24 43
         this.timeoutBodyColumns_ = 0;
25 44
         this.$fixedBody.find('table').attr('class', this.$el.attr('class'));
26
-        this.$fixedHeaderColumns = this.$fixedBody.find('thead');
27 45
         this.$fixedBodyColumns = this.$fixedBody.find('tbody');
28 46
         this.$tableBody.before(this.$fixedBody);
29 47
     };
@@ -37,14 +55,13 @@
37 55
 
38 56
         this.initFixedColumns();
39 57
 
40
-        var $tr = this.$header.find('tr:eq(0)').clone(),
41
-            $ths = $tr.clone().find('th');
42
-
43
-        $tr.html('');
44
-        for (var i = 0; i < this.options.fixedNumber; i++) {
45
-            $tr.append($ths.eq(i).clone());
46
-        }
47
-        this.$fixedHeaderColumns.html('').append($tr);
58
+        var that = this, $trs = this.$header.find('tr').clone(true); //Fix: Aleksej "clone()" mit "clone(true)" ersetzt
59
+        $trs.each(function () {
60
+            // This causes layout problems:
61
+            //$(this).find('th:gt(' + (that.options.fixedNumber -1) + ')').remove(); // Fix: Aleksej "-1" hinnzugefügt. Denn immer eine Spalte Mehr geblieben ist
62
+            $(this).find('th:gt(' + that.options.fixedNumber + ')').remove();
63
+        });
64
+        this.$fixedHeaderColumns.html('').append($trs); 
48 65
     };
49 66
 
50 67
     BootstrapTable.prototype.initBody = function () {
@@ -54,18 +71,31 @@
54 71
             return;
55 72
         }
56 73
 
57
-        var that = this;
74
+        var that = this,
75
+            rowspan = 0;
58 76
 
59 77
         this.$fixedBodyColumns.html('');
60 78
         this.$body.find('> tr[data-index]').each(function () {
61 79
             var $tr = $(this).clone(),
62
-                $tds = $tr.clone().find('td');
80
+                $tds = $tr.find('td');
81
+
82
+            var dataIndex = $tr.attr("data-index");
83
+            $tr = $("<tr></tr>");
84
+            $tr.attr("data-index", dataIndex);
63 85
 
64
-            $tr.html('');
65
-            for (var i = 0; i < that.options.fixedNumber; i++) {
86
+            var end = that.options.fixedNumber;
87
+            if (rowspan > 0) {
88
+                --end;
89
+                --rowspan;
90
+            }
91
+            for (var i = 0; i < end; i++) {
66 92
                 $tr.append($tds.eq(i).clone());
67 93
             }
68 94
             that.$fixedBodyColumns.append($tr);
95
+            
96
+            if ($tds.eq(0).attr('rowspan')){
97
+                rowspan = $tds.eq(0).attr('rowspan') - 1;
98
+            }
69 99
         });
70 100
     };
71 101
 
@@ -100,28 +130,90 @@
100 130
                 index = i - 1;
101 131
             }
102 132
 
103
-            that.$fixedBody.find('thead th[data-field="' + visibleFields[index] + '"]')
104
-                .find('.fht-cell').width($this.innerWidth() - 1);
133
+            var $th = that.$fixedHeader.find('th[data-field="' + visibleFields[index] + '"]');
134
+            $th.find('.fht-cell').width($this.innerWidth());
105 135
             headerWidth += $this.outerWidth();
136
+
137
+            $th.data('fix-pos', index);
106 138
         });
107
-        this.$fixedBody.width(headerWidth - 1).show();
139
+        this.$fixedHeader.width(headerWidth + 1).show();
140
+
141
+        // fix click event
142
+        this.$fixedHeader.delegate("tr th", 'click', function() {
143
+            $(this).parents(".fixed-table-container").find(".fixed-table-body table thead tr th:eq("+$(this).data("fix-pos")+") .sortable").click();
144
+        })
108 145
     };
109 146
 
110
-    BootstrapTable.prototype.fitBodyColumns = function () {
111
-        var that = this,
112
-            top = -(parseInt(this.$el.css('margin-top')) - 2),
113
-            height = this.$tableBody.height() - 2;
147
+    /**
148
+    * Add: Aleksej
149
+    * Hook für getCaret. Aktualisieren Header bei Fixed-Columns wenn diese sortiert wurden
150
+    * @method getCaret
151
+    * @for BootstrapTable
152
+    */
153
+    BootstrapTable.prototype.getCaret = function () {
154
+        var result = _getCaret.apply(this, arguments);
155
+
156
+        if (this.options.fixedColumns && this.$fixedHeaderColumns instanceof jQuery) {
157
+            var that = this, $th;
158
+
159
+            $.each(this.$fixedHeaderColumns.find('th'), function (i, th) {
160
+                $th = $(th);
161
+                $th.find('.sortable').removeClass('desc asc').addClass($th.data('field') === that.options.sortName ? that.options.sortOrder : 'both');
162
+            });
163
+        }
164
+
165
+     return result;
166
+    };
167
+
168
+    /**
169
+     * Add: Aleksej, zum berechnen von Scrollbar-Größe
170
+     * @method calcScrollBarSize
171
+     * @return Number
172
+     */
173
+    BootstrapTable.prototype.calcScrollBarSize = function () {
174
+        // Es ist egal, ob Höhe oder Breite
175
+        var tmpWidth        = 100,
176
+            $container      = $('<div>').css({
177
+                width       : tmpWidth, 
178
+                overflow    : 'scroll', 
179
+                visibility  : 'hidden'}
180
+            ).appendTo('body'),
181
+            widthWithScroll = $('<div>').css({
182
+                width: '100%'
183
+            }).appendTo($container).outerWidth();
184
+
185
+        $container.remove();
186
+        return tmpWidth - widthWithScroll;
187
+    };
114 188
 
189
+    BootstrapTable.prototype.fitBodyColumns = function () {
190
+        var that            = this,
191
+            borderHeight    = (parseInt(this.$el.css('border-bottom-width')) + parseInt(this.$el.css('border-top-width'))), // Add. Aleksej
192
+            top             = this.$fixedHeader.outerHeight() + borderHeight, // Fix. Aleksej "-2" mit "+ borderHeight" ersetzt
193
+            // the fixed height should reduce the scorll-x height
194
+            height          = this.$tableBody.height() - this.calcScrollBarSize(); // Fix. Aleksej "-14" mit "- this.calcScrollBarSize()" ersetzt
195
+            
115 196
         if (!this.$body.find('> tr[data-index]').length) {
116 197
             this.$fixedBody.hide();
117 198
             return;
118 199
         }
119 200
 
201
+        if (!this.options.height) {
202
+            top = this.$fixedHeader.height();
203
+            height = height - top;
204
+        }
205
+
206
+        this.$fixedBody.css({
207
+            width: this.$fixedHeader.width(),
208
+            height: height,
209
+            top: top
210
+        }).show();
211
+
120 212
         this.$body.find('> tr').each(function (i) {
121
-            that.$fixedBody.find('tbody tr:eq(' + i + ')').height($(this).height() - 1);
213
+            that.$fixedBody.find('tr:eq(' + i + ')').height($(this).height() - 1);
122 214
         });
123 215
 
124
-        //// events
216
+        // events
125 217
         this.$tableBody.on('scroll', function () {
126 218
             that.$fixedBody.find('table').css('top', -$(this).scrollTop());
127 219
         });
@@ -139,7 +231,12 @@
139 231
             var index = $(this).data('index');
140 232
             that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover');
141 233
         });
234
+
235
+        // fix td width bug
236
+        var $first_tr = that.$body.find('tr:eq(0)');
237
+        that.$fixedBody.find('tr:eq(0)').find("td").each(function(index) {
238
+            $(this).width($first_tr.find("td:eq("+index+")").width())
239
+        });
142 240
     };
143 241
 
144 242
 })(jQuery);
145
-