Skip to content

Commit 3587e07

Browse files
committed
renamed branch
2 parents 0b5b12c + 65dd14b commit 3587e07

15 files changed

+110
-37
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## 1.2.0
4+
5+
### Enhancements & Features
6+
- Fixed table headers
7+
- Fixed table column
8+
- Sorted header column CSS class
9+
- Improved destroy method
10+
- Improved ajax request settings [#27](http://github.com/rstaib/jquery-bootgrid/issues/27)
11+
12+
### Bug Fixes
13+
- ...
14+
315
## 1.1.1
416

517
### Bug Fixes

bootgrid.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"accessibility",
1515
"bootstrap"
1616
],
17-
"version": "1.1.1",
17+
"version": "1.2.0",
1818
"author": {
1919
"name": "Rafael Staib",
2020
"email": "me@rafaelstaib.com",

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"accessibility",
1414
"bootstrap"
1515
],
16-
"version": "1.1.1",
16+
"version": "1.2.0",
1717
"authors": [
1818
{ "name": "Rafael Staib", "email": "me@rafaelstaib.com", "url": "http://www.rafaelstaib.com" }
1919
],

build/jQuery.Bootgrid.1.1.1.nupkg

-22.6 KB
Binary file not shown.

build/jQuery.Bootgrid.1.2.0.nupkg

22.8 KB
Binary file not shown.

build/jquery.bootgrid-1.1.1.zip

-24.2 KB
Binary file not shown.

build/jquery.bootgrid-1.2.0.zip

24.5 KB
Binary file not shown.

build/jquery.bootgrid.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
top: 2px;
9595
}
9696
.bootgrid-table th:hover,
97-
.bootgrid-table th:active {
98-
background: #fafafa;
97+
.bootgrid-table th:active,
98+
.bootgrid-table th.active {
99+
background: #fafafa !important;
99100
}
100101
.bootgrid-table td {
101102
overflow: hidden;

build/jquery.bootgrid.js

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Bootgrid v1.1.1 - 09/24/2014
2+
* jQuery Bootgrid v1.2.0 - 09/24/2014
33
* Copyright (c) 2014 Rafael Staib (http://www.jquery-bootgrid.com)
44
* Licensed under MIT http://www.opensource.org/licenses/MIT
55
*/
@@ -133,7 +133,7 @@
133133
}
134134

135135
// ensures that only the first order will be applied in case of multi sorting is disabled
136-
if (!that.options.multiSort && column.order !== null)
136+
if (!that.options.multiSort && column.order != null)
137137
{
138138
sorted = true;
139139
}
@@ -751,7 +751,8 @@
751751
(sorting && sortOrder && sortOrder === "desc") ? css.iconDown : ""),
752752
icon = tpl.icon.resolve(getParams.call(that, { iconCss: iconCss })),
753753
align = column.headerAlign,
754-
cssClass = (column.headerCssClass.length > 0) ? " " + column.headerCssClass : "";
754+
cssClass = ((column.headerCssClass.length > 0) ? " " + column.headerCssClass : "") +
755+
((that.options.highlightColumns && column.order != null) ? " " + that.options.css.active : "");
755756
html += tpl.headerCell.resolve(getParams.call(that, {
756757
column: column, icon: icon, sortable: sorting && column.sortable && css.sortable || "",
757758
css: ((align === "right") ? css.right : (align === "center") ?
@@ -764,27 +765,29 @@
764765
// todo: create a own function for that piece of code
765766
if (sorting)
766767
{
767-
var sortingSelector = getCssSelector(css.sortable),
768+
var activeSelector = getCssSelector(css.active),
769+
sortingSelector = getCssSelector(css.sortable),
768770
iconSelector = getCssSelector(css.icon);
769771
headerRow.off("click" + namespace, sortingSelector)
770772
.on("click" + namespace, sortingSelector, function (e)
771773
{
772774
e.preventDefault();
773775
var $this = $(this),
774776
columnId = $this.data("column-id") || $this.parents("th").first().data("column-id"),
775-
sortOrder = that.sort[columnId],
776-
icon = $this.find(iconSelector);
777+
sortOrder = that.sort[columnId];
777778

778779
if (!that.options.multiSort)
779780
{
780-
$this.parents("tr").first().find(iconSelector).removeClass(css.iconDown + " " + css.iconUp);
781+
$this.parents("tr:first").find(iconSelector).removeClass(css.iconDown + " " + css.iconUp)
782+
.end().find(activeSelector).removeClass(css.active);
781783
that.sort = {};
782784
}
783785

784786
if (sortOrder && sortOrder === "asc")
785787
{
786788
that.sort[columnId] = "desc";
787-
icon.removeClass(css.iconUp).addClass(css.iconDown);
789+
$this.parent().addClass(css.active).find(iconSelector)
790+
.removeClass(css.iconUp).addClass(css.iconDown);
788791
}
789792
else if (sortOrder && sortOrder === "desc")
790793
{
@@ -799,18 +802,21 @@
799802
}
800803
}
801804
that.sort = newSort;
802-
icon.removeClass(css.iconDown);
805+
$this.parent().removeClass(css.active).find(iconSelector)
806+
.removeClass(css.iconDown);
803807
}
804808
else
805809
{
806810
that.sort[columnId] = "asc";
807-
icon.removeClass(css.iconDown).addClass(css.iconUp);
811+
$this.parent().addClass(css.active).find(iconSelector)
812+
.removeClass(css.iconDown).addClass(css.iconUp);
808813
}
809814
}
810815
else
811816
{
812817
that.sort[columnId] = "asc";
813-
icon.addClass(css.iconUp);
818+
$this.parent().addClass(css.active).find(iconSelector)
819+
.addClass(css.iconUp);
814820
}
815821

816822
sortRows.call(that);
@@ -951,6 +957,7 @@
951957
this.header = null;
952958
this.footer = null;
953959
this.xqr = null;
960+
this.original = this.element.clone();
954961

955962
// todo: implement cache
956963
};
@@ -1021,6 +1028,17 @@
10211028
**/
10221029
keepSelection: false,
10231030

1031+
/**
1032+
* Defines whether the columns which are filtered or sorted should be highlighted or not.
1033+
*
1034+
* @property highlightColumns
1035+
* @type Boolean
1036+
* @default false
1037+
* @for defaults
1038+
* @since 1.2.0
1039+
**/
1040+
highlightColumns: false,
1041+
10241042
highlightRows: false, // highlights new rows (find the page of the first new row)
10251043
sorting: true,
10261044
multiSort: false,
@@ -1113,6 +1131,18 @@
11131131
**/
11141132
css: {
11151133
actions: "actions btn-group", // must be a unique class name or constellation of class names within the header and footer
1134+
1135+
/**
1136+
* CSS class to highlight active parts like sorted or filtered columns.
1137+
*
1138+
* @property active
1139+
* @type String
1140+
* @default "active"
1141+
* @for css
1142+
* @since 1.2.0
1143+
**/
1144+
active: "active",
1145+
11161146
center: "text-center",
11171147
columnHeaderAnchor: "column-header-anchor", // must be a unique class name or constellation of class names within the column header cell
11181148
columnHeaderText: "text",
@@ -1234,7 +1264,7 @@
12341264
{
12351265
if (this.options.ajax)
12361266
{
1237-
// todo: implement ajax DELETE
1267+
// todo: implement ajax POST
12381268
}
12391269
else
12401270
{
@@ -1298,7 +1328,7 @@
12981328
{
12991329
this.footer.remove();
13001330
}
1301-
this.element.remove("tbody").off(namespace).removeData(namespace);
1331+
this.element.before(this.original).remove();
13021332

13031333
return this;
13041334
};

build/jquery.bootgrid.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)