Skip to content

Instantly share code, notes, and snippets.

@mnishiguchi
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save mnishiguchi/920ed66b964330c7f4c1 to your computer and use it in GitHub Desktop.

Select an option

Save mnishiguchi/920ed66b964330c7f4c1 to your computer and use it in GitHub Desktop.
TableSorter( jQuery plug-in)で簡単に表のソートを実装する。 ref: http://qiita.com/mnishiguchi/items/87aacf94eee776aa261a
%table#myTable
%thead
%tr
%th
%span.arrow
/ <=ここにアイコンを挿入する。
%th
%span.arrow
/ <=ここにアイコンを挿入する。
%th{ span: "2" }
%tbody
%tr
%td 列1データ1
%td 列1データ2
%td ...
%td ...
%tr
%td 列2データ1
%td 列2データ2
%td ...
%td ...
...
$(document).ready ->
$("#myTable").tablesorter()
/* ヘッダーをクリックすると勝手にハイライトされるので、それを除去する。 */
th:focus { outline: 0 none; }
/* 三角印アイコンをヘッダーに追加する */
th.tablesorter-headerUnSorted span.arrow,
th.tablesorter-headerAsc span.arrow,
th.tablesorter-headerDesc span.arrow {
position: relative;
}
th.tablesorter-headerUnSorted span.arrow:before {
content: "\f0dc";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #ABC;
}
th.tablesorter-headerAsc span.arrow:before {
content: "\f0de";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}
th.tablesorter-headerDesc span.arrow:before {
content: "\f0dd";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment