Need to sort specific column in datatable.
Need to sort specific column in datatable.
avneesh_kumar
Posts: 1Questions: 0Answers: 0
Hi,
I am using jquery datatable plugin in MVC app. I did disable sorting for certain columns as said in examples in datatable plugin examples but its not working for disabled sorting columns. it works for all columns still. so please help me on this..
oTable = $('#companies').dataTable({
"bSort": true,
"bJQueryUI": true,
"bPaginate": true,
"bFilter": true,
"sScrollX": "100%",
"sScrollXInner": "100%",
"bScrollCollapse": true,
"aLengthMenu": [[5, 10, 20, 50, 100], [5, 10, 20, 50, 100]],
"bServerSide": true,
"sAjaxSource": "Some URL",
"aoColumnDefs": [
{ "bSortable": false, 'aTargets': [0,4] }
],
"aoColumns": [
{"bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
currentId = oObj.aData[0];
var check = ('@ViewData["DealerId"]' != '') ? (('@ViewData["DealerId"]' == oObj.aData[0]) ? "checked='checked'" : '') : '';
if ('@ViewData["DealerId"]' != '') {
if ('@ViewData["DealerId"]' == oObj.aData[0])
FillRegistrationForm(oObj.aData[0], oObj.aData[5]);
}
return '';
}
},
{ "bSortable": true, "sName": "DealerCode" },
{ "bSortable": true, "sName": "ShipperCode" },
{ "bSortable": true, "sName": "AffiliationCode" },
{ /* Dealer Information */
"bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
return oObj.aData[4];
}
},
{ "bSortable": true, "sName": "Registered" },
{ "bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
var disabled = "";
if (oObj.aData[5] == "Unregistered") disabled = "disabled='disabled'";
if (oObj.aData[6] == '1')
return '';
else
return '';
}
}
]
});
I am using jquery datatable plugin in MVC app. I did disable sorting for certain columns as said in examples in datatable plugin examples but its not working for disabled sorting columns. it works for all columns still. so please help me on this..
oTable = $('#companies').dataTable({
"bSort": true,
"bJQueryUI": true,
"bPaginate": true,
"bFilter": true,
"sScrollX": "100%",
"sScrollXInner": "100%",
"bScrollCollapse": true,
"aLengthMenu": [[5, 10, 20, 50, 100], [5, 10, 20, 50, 100]],
"bServerSide": true,
"sAjaxSource": "Some URL",
"aoColumnDefs": [
{ "bSortable": false, 'aTargets': [0,4] }
],
"aoColumns": [
{"bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
currentId = oObj.aData[0];
var check = ('@ViewData["DealerId"]' != '') ? (('@ViewData["DealerId"]' == oObj.aData[0]) ? "checked='checked'" : '') : '';
if ('@ViewData["DealerId"]' != '') {
if ('@ViewData["DealerId"]' == oObj.aData[0])
FillRegistrationForm(oObj.aData[0], oObj.aData[5]);
}
return '';
}
},
{ "bSortable": true, "sName": "DealerCode" },
{ "bSortable": true, "sName": "ShipperCode" },
{ "bSortable": true, "sName": "AffiliationCode" },
{ /* Dealer Information */
"bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
return oObj.aData[4];
}
},
{ "bSortable": true, "sName": "Registered" },
{ "bSortable": false, "bSearchable": false,
"fnRender": function (oObj) {
var disabled = "";
if (oObj.aData[5] == "Unregistered") disabled = "disabled='disabled'";
if (oObj.aData[6] == '1')
return '';
else
return '';
}
}
]
});
This discussion has been closed.
Replies