私はテーブルを持っていて、別の列の見出しをクリックした後、並べ替えを行う他の列をリセットしたいと思います。現在、私は持っている:私は最初の列の並べ替えを実行すると別の列がクリックされたときにタイトルを変更するJavascript
<html>
<head>
<script>
function changeSort(obj)
{
var firstName = document.getElementById('fName');
var lastName = document.getElementById('lName');
var phoneNumber = document.getElementById('phone');
var birthDate = document.getElementById('birth');
if(obj.id == 'fName')
{
//alert("fName");
obj.title = (obj.title== 'sort ascending first name') ? 'sort descending first
name' : 'sort ascending first name';
}
if(obj.id == 'lName')
{
//alert("lName");
obj.title = (obj.title== 'sort ascending last name') ? 'sort descending first name' : 'sort
ascending last name';
}
if(obj.id == 'phone')
{
//alert("phone");
obj.title = (obj.title== 'sort ascending phone number') ? 'sort descending phone
number' : 'sort ascending phone number';
}
if(obj.id == 'birth')
{
//alert("birth");
obj.title = (obj.title== 'sort ascending birth date') ? 'sort descending birth
date' : 'sort
ascending birth date';
}
}
</script>
</head>
<body
<table>
<tr>
<th id="fName" onclick='changeSort(this)' title="sort by First Name" >First Name</th>
<th id="lName" onclick='changeSort(this)' title="sort by Last Name" >Last
Name</th>
<th id="phone" onclick='changeSort(this)' title="sort by Phone Number" >Phone
Number</th>
<th id="birth" onclick='changeSort(this)'title="sort by Birth Date" >Birth
Date</th>
</tr>
</table>
</body>
</html>
が、私はそれが現在私が決定した場合、私は私が望む最後の名前でソートしたいん昇順または降順にタイトルを変更したいです最初の名前は、名前をソートして昇順または降順に戻すように変更するタイトルです。別のテーブルの頭がclcikedされているときに、変更されたテーブルの頭をデフォルトに戻すにはどうしたらいいですか?あなたが追加する必要があり、関数の最後で
[jquery tablesorterの変更のヘッダータイトルの並べ替えの並べ替え](http://stackoverflow.com/questions/9046715/jquery-tablesorter-change-header-title-ttributes-on-sort) – Mottie
可能な複製httpの://stackoverflow.com/questions/9027508/jquery-tablesorter-add-title-tooltip-to-show-ascending-descending – Mottie