Skip to content

Commit

Permalink
Add css-class for all sortable columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiash committed Aug 21, 2013
1 parent f1ea879 commit 7d9df7e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ The `ts-repeat` attribute must be set on the element with ng-repeat.
CSS
---

The table headings that the table is currently sorted on is styled with `tablesort-asc` and `tablesort-desc` classes. A very ugly stylesheet is included to show that it works, but you probably want to build your own...
All table headings that can be sorted on is styled with css-class `tablesort-sortable`. The table headings that the table is currently sorted on is styled with `tablesort-asc` or `tablesort-desc` classes depending on the sort-direction. A very ugly stylesheet is included to show that it works, but you probably want to build your own...
1 change: 1 addition & 0 deletions js/angular-tablesort.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ tableSortModule.directive('tsCriteria', function() {
} );
};
element.bind('click', clickingCallback);
element.addClass('tablesort-sortable');
if( "tsDefault" in attrs && attrs.tsDefault !== "0" ) {
tsWrapperCtrl.addSortField( attrs.tsCriteria, element );
}
Expand Down
4 changes: 3 additions & 1 deletion tablesort.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ th.tablesort-asc {
th.tablesort-desc {
background-color: #F00;
}
th {

th.tablesort-sortable {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
cursor: pointer;
}
2 changes: 2 additions & 0 deletions test1.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Angular Tablesort</h2>
<table border="1" ts-wrapper>
<thead>
<tr>
<th>Select</th>
<th ts-criteria="Id">Id</th>
<th ts-criteria="Name|lowercase" ts-default>Name</th>
<th ts-criteria="Price|parseFloat">Price</th>
Expand All @@ -20,6 +21,7 @@ <h1>Angular Tablesort</h2>
</thead>
<tbody>
<tr ng-repeat="item in items" ts-repeat>
<td><input type="checkbox"></input>
<td>{{item.Id}}</td>
<td>{{item.Name}}</td>
<td>{{item.Price | currency}}</td>
Expand Down

0 comments on commit 7d9df7e

Please sign in to comment.