Google でこの問題の解決策をしばらく探していましたが、間違ったものを探しているか、ニーズを満たすものを見つけることができません。
jQuery テーブル プラグイン、または以下を実現できるそれぞれの機能が必要です。
- AJAX 経由でテーブルの内容を読み込む
- 自動ページネーション
- 列の並べ替え
- 自動更新のタイムアウト (頻繁に AJAX と対話し、変更された行または追加する必要がある行のみを更新します) <-- これは最も重要です。
その実装は次のようなものになると思います。
<table class="autoTable">
<thead>
<tr>
<th>Custom Row Name 1</th>
<th>Custom Row Name 2</th>
<th>Custom Row Name 3</th>
<th>Custom Row Name 4</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
そして、次のようなもの:
$('.autoTable').each(function() {
$(this).autoTable({
timeout: 500
url: "ajax/test.json"
});
});
次のような JSON 値を使用します。
[
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
},
{
"row1": "Lorem",
"row2": "Ipsum",
"row3": "Dolor",
"row4": "Sit"
}
]
うまくいけば、あなたは何かを知っています。