0
나는 약간의 정보가있는 테이블을 가지고있다. 처음에는 php-script에서 생성 한 다음 n 초마다 데이터베이스를 검사합니다.테이블 정리 및 절약 정렬
그럼 tablesorter 플러그인을 설치했습니다. 괜찮습니다.하지만 데이터베이스에서 정보를 얻은 후에 (테이블이 여러 필드로 정렬 된 경우) 정렬 "구성"이 재설정됩니다.
saveSort 플러그인에 대한 정보를 찾았으므로 jquery.tablesorter.widgets.js
을 다운로드하여 프로젝트에 포함하십시오. 플러그인 설명서에서 나는 how to
과 같은 명령어를 발견했습니다.
$("table").tablesorter({
widgets: ["saveSort"]
});
하지만 내 문제는 해결되지 않습니다. 결과를 얻은 후에는 저장된 정렬이 재설정됩니다.
다음$(document).ready(function(){
$("table").tablesorter({
widgets: ["saveSort"]
});
function get_op(){
var dataSend = "to teh mooon";
jQuery.ajax({
type: "POST",
url: "get_url",
dataType:"html",
data:dataSend,
success:function(response){
$("#recent_op tbody").html(response);
$("#recent_op").trigger("update");
},
error:function (xhr, ajaxOptions, thrownError){
$("#recent_operations").html(thrownError);
}
});
}
setInterval(function(){get_op()}, 10000);
});
내가 사용하는 간단한 테이블입니다 :
그래서, 여기 내 스크립트의 코드입니다.
<table class="table table-bordered table-hover table-striped tablesorter" id = "recent_op">
<thead>
<tr>
<th>header # <i class="fa fa-sort"></i></th>
....
</tr>
</thead>
<tbody>
<tr>
<td>Body</td>
....
</tr>
....
<tr>
<td>Body</td>
....
</tr>
</tbody>
</table>
자습서의 모든 오류는 없지만 제대로 작동하지 않습니다. 나는이 위젯을 잘못된 방식으로 사용하고 있다고 생각합니다.