我使用 fnRowCallback 函数在表中加载动态列。它工作正常。当分页到下一页到上一页时,我真的不想再次调用动态字段。因为它已经加载了。
如何停止从分页加载动态字段到上一页。请检查下面的代码
tickerdashboardtable = $('#tickerdashboardtable').dataTable( {
"bProcessing": true,
"sAjaxSource": "/dashboard/getlisttickers",
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var loadtxt = "<img class='alert-bell'src='/image/temp/user_signal_icon.png'><span class='signal_count'><img src='/image/waiting-circle-lines.gif'></span>";
// no need to load 2nd time
if(aData[5] == loadtxt) {
$("#tickerdashboardtable_next").hide();
var remainder = rowId % 10;
$('td:eq(0)', nRow).html( '<span class=\'grid_collapse\'></span>'+aData[0]);
$.ajax({
type: "GET",
url: "/dashboard/getSignalCount",
data: { ticker: aData[0],mode: "discern" },
success: function (data) {
$('td:eq(4)', nRow).html( '<img class=\'alert-bell\'src=\'/image/temp/discern_signal_icon.png\'><span class=\'signal_count\'>'+data+'</span>');
}
});
},
"aoColumns": [
{ "sClass": "align_left", "bSortable": true },
{ "sClass": "cnter", "bSortable": false },
{ "sClass": "cnter", "bSortable": false },
{ "sClass": "cnter", "bSortable": false },
{ "sClass": "cnter", "bSortable": false },
{ "sClass": "cnter", "bSortable": false },
{ "sClass": "cnter", "bSortable": false }
]
} );