我想實現jQuery的數據表中的函數,返回的第一個和點擊行JQuery的DataTable中單擊單元格
我下面這個例子中,第4列,這讓我操縱一個被點擊排 http://datatables.net/examples/api/select_single_row.html
以爲我可以改變這個處理程序做讀取單元格值程序,並用我自己的邏輯值
/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function(){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
我也用這個小小的代碼段FR過來OM的dataTable論壇http://datatables.net/forums/comments.php?DiscussionID=1384&page=1#Item_0
$('#example tbody tr').click(function() {
// Alert the contents of an element in a SPAN in the first TD
alert($('td:eq(0) span', this).html());
});
可我有任何指針,所以我可以得到點擊場的第1和第4列?
下一部分 我上面的解決了,感謝尼克
但是我的問題的一個部分。當我初始化表 我使用
/* Init the table */
oTable = $('#filetable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/crvWeb/jsonFileList.do",
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
我的servlet需要一個目錄請求參數和返回的列表到DataTable的JSON響應。
/crvWeb/jsonFileList.do
我該如何添加和獲得serlvet回覆與發佈請求,所以我可以讓我的表更新?
再一次跟進問題。如果我想將值傳遞給網格來更新它,我應該如何使用函數的功能來更新動態表格? – nokheat 2010-07-07 03:12:05
@nokheat - 你是什麼意思?如果你可以更詳細地描述值的來源和去向,我可能會幫助...我必須在夜間崩潰,但在這裏回覆,我會在早上檢查:) – 2010-07-07 03:13:22
我需要顯示一些代碼段,所以請參考我最近編輯的 – nokheat 2010-07-07 04:25:54