我正在使用数据表服务器端,我在一列中显示多个值。
问题是,当在一列中组合这些值(变量)时,排序和过滤将停止为此列工作。如果我不使用服务器端,它可以很好地工作。
这是我的代码:
"aaSorting": [[ 0, 'desc' ]],
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 7 ] } ],
"iDisplayLength": 15,
"aLengthMenu": [[15, 30, 50, -1], [15, 30, 50, "All"]],
/* Highlight and Unhighlight a search result */
"searchHighlight": true,
"processing": true,
"serverSide": true,
"sAjaxSource": './xd_server_side/get_list_of_clients',
"aoColumns": [
{ mData: 'comp_clients_id' } ,
{
mData: null,
sClass: "text-left",
sDefaultContent: "",
fnRender: function (o) {
return '<h4><strong>' + o.aData[2] +'</strong></h4><strong>Default Email: </strong>' + o.aData[3] + '<br><strong>Mobile: </strong>' + o.aData[4] + '<br><strong>Address: </strong>' + o.aData[5]
}
},
{
mData: null,
sClass: "text-left",
sDefaultContent: "",
fnRender: function (o) {
return o.aData[7]
}
},
{ mData: 'branch_name' },
{ mData: 'country_name' },
{ mData: 'comp_clients_status' },
{
mData: null,
sClass: "text-left",
sDefaultContent: "",
fnRender: function (o) {
return '<h4>' + o.aData[10] +'</h4>' + o.aData[11]
}
},
{
// This is to add the delete button on each row
mData: null,
sClass: "text-center",
sDefaultContent: "",
fnRender: function (o) {
var delete_access = user_access == 3 ? 'disabled' : '';
return '<a href="crm_clients_edit?cid='+ o.aData[0] + '" data-toggle="tooltip" data-placement="top" title="Edit Current Client!" class="btn btn-xs btn-primary"' + delete_access + '><i class="fa fa-edit"></i></a> <a href="#add-address" data-id="'+ o.aData[0] + '" data-clientname="'+ o.aData[1] + '" class="btn btn-xs btn-primary addaddress" data-toggle="modal" ' + delete_access + '>+ <i class="fa fa-home"></i></a> <a onclick="activate('+ o.aData[0] + ', '+ o.aData[2] + ', '+ o.aData[3] + ')" data-toggle="tooltip" data-placement="top" title="Click to Change Status!" class="btn btn-xs btn-success statusRow"><i class="fa fa-spinner"></i></a> <a onclick="delete_client('+ o.aData[0] + ')" data-toggle="tooltip" data-placement="top" title="Click to Delete!"id="delRow' + o.aData[2] + '" class="btn btn-xs btn-danger delRow" ' + delete_access + '><i class="fa fa-times"></i></a>'
}
}
],
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var sDirectionClass;
if ( aData[6] == "Active" )
sDirectionClass = "";
else
sDirectionClass = "danger themed-color-dragon";
$(nRow).addClass( sDirectionClass );
return nRow;
}
});