我在獲取數據表(http://datatables.net/)以在簡單的jquery對話框中工作時遇到問題。當我點擊一個按鈕打開盒子時,您可以看到數據表大約一秒鐘,然後立即關閉。任何想法都會非常感激。DataTables和jQuery對話框的問題
我的啓動對話框的功能如下所示。在它內部,數據表被初始化。
function launchLocDialog(mydiv) {
alert(mydiv);
var oTable;
var giRedraw = false;
$(document).ready(function() {
$("#table_id tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function(){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});
oTable = $('#table_id').dataTable({
"aaData": [ /* Reduced data set */
[ "1", "02/22/12"],
[ "2", "02/22/12"],
[ "3", "02/22/12"],
[ "4", "02/22/12"],
[ "5", "02/22/12"],
[ "6", "02/22/12"],
[ "7", "02/22/12"],
[ "8", "02/22/12"],
[ "9", "02/22/12"],
[ "10", "02/22/12"],
[ "11", "02/22/12"],
[ "12", "02/22/12"],
],
"aoColumns": [
{ "sTitle": "Number" },
{ "sTitle": "Date Start" }
]
});
oTable.$('td').click(function() {
//var anSelected = fnGetSelected(oTable);
var sData = oTable.fnGetData(0,0);
//alert('The cell clicked on had the value of '+sData);
alert(sData);
//$.post('intsum.php', {intsumID: sData});
// window.location = "intsum.php";
});
});
$("#dialog:ui-dialog").dialog("destroy");
$("#dialog").dialog({
modal: true,
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
}
我會非常高興地推薦你檢查一下slickGrid – 2012-04-02 06:43:09