选择单行无功能
我有一个数据表..但单击行后无法选择一行.. 你能告诉我错在哪里吗?
oTable = $("#datalist").dataTable({
"bRetrieve" : true,
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": 'showlist.php',
"fnServerData": function (sSource,aoData,fnCallback){
aoData.push({"name":"line","value":$("#showline").val()});
aoData.push({"name":"model","value":$("#showmodel").val()});
aoData.push({"name":"serial","value":$("#serial").val()});
aoData.push({"name":"NIK","value":$("#showNIK").val()});
$.ajax({
"dataType":'json',
"type":'POST',
"url":sSource,
"data":aoData,
"success":function(json){
fnCallback(json);
}
});
},
"aaSorting" : [[1,"desc"]],
"aoColumns" : [
/*Line*/ null,
/*Model*/ null,
/*Serial*/null,
/*NIK*/ null
]
});
}else{
oTable.fnDraw();
}
});
function fnGetSelected( oTableLocal ) {
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i<aTrs.length ; i++ )
{
if ( $(aTrs[i]).hasClass('row_selected') )
{
aReturn.push( aTrs[i] );
}
}
return aReturn;
}
i have a data table..but it can't select one row after click the row..
can you tell me where the mistake??
oTable = $("#datalist").dataTable({
"bRetrieve" : true,
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": 'showlist.php',
"fnServerData": function (sSource,aoData,fnCallback){
aoData.push({"name":"line","value":$("#showline").val()});
aoData.push({"name":"model","value":$("#showmodel").val()});
aoData.push({"name":"serial","value":$("#serial").val()});
aoData.push({"name":"NIK","value":$("#showNIK").val()});
$.ajax({
"dataType":'json',
"type":'POST',
"url":sSource,
"data":aoData,
"success":function(json){
fnCallback(json);
}
});
},
"aaSorting" : [[1,"desc"]],
"aoColumns" : [
/*Line*/ null,
/*Model*/ null,
/*Serial*/null,
/*NIK*/ null
]
});
}else{
oTable.fnDraw();
}
});
function fnGetSelected( oTableLocal ) {
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i<aTrs.length ; i++ )
{
if ( $(aTrs[i]).hasClass('row_selected') )
{
aReturn.push( aTrs[i] );
}
}
return aReturn;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道它应该如何适合您的代码,并且您的问题需要更多充实,但我假设您可以选择单击的行旁边的行,如下所示:
I don't know exactly how it is supposed to fit into your code, and your question needs more fleshing out, but I suppose you could select the row next to the clicked one like this: