Skip to content

Commit d1f1722

Browse files
author
Vincent Loh
committed
Add extension.json, use sprintf as suggested
1 parent 4b262ce commit d1f1722

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎src/extensions/sticky-header/bootstrap-table-sticky-header.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
(function ($) {
99
'use strict';
1010

11+
var sprintf = $.fn.bootstrapTable.utils.sprintf;
1112
$.extend($.fn.bootstrapTable.defaults, {
1213
stickyHeader: false
1314
});
@@ -28,9 +29,10 @@
2829
var anchor_begin_id = header_id +'_sticky_anchor_begin';
2930
var anchor_end_id = header_id +'_sticky_anchor_end';
3031
// add begin and end anchors to track table position
31-
table.before('<div id="'+sticky_header_container_id+'" class="hidden"></div>');
32-
table.before('<div id="'+anchor_begin_id+'"></div>');
33-
table.after('<div id="'+anchor_end_id+'"></div>');
32+
33+
table.before(sprintf('<div id="%s" class="hidden"></div>', sticky_header_container_id));
34+
table.before(sprintf('<div id="%s"></div>', anchor_begin_id));
35+
table.after(sprintf('<div id="%s"></div>', anchor_end_id));
3436

3537
table.find('thead').attr('id', header_id);
3638

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Sticky Header",
3+
"version": "1.0.0",
4+
"description": "An extension which provides a sticky header for table columns when scrolling on a long page and / or table. Works for tables with many columns and narrow width with horizontal scrollbars too.",
5+
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/sticky-header",
6+
"example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/sticky-header.html",
7+
8+
"plugins": [{
9+
"name": "bootstrap-table-sticky-header",
10+
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/sticky-header"
11+
}],
12+
13+
"author": {
14+
"name": "vinzloh",
15+
"image": "https://avatars0.githubusercontent.com/u/5501845"
16+
}
17+
}

0 commit comments

Comments
 (0)