Cant sort across 3 columns
Cant sort across 3 columns
I'm trying to sort by 3 columns when one column or another is sorted i want to sort by,
last name then first name then policy batch id when last name is sorted
first name then last name then policy batch id when first name is sorted
first and last name seem to sort correctly but PBID does not when i have records with the same last name and first name if doesn't seem like there is any order to them.
Normally the PBID column is hidden, i thought that was the problem but even un-hiding it did not work.
I've been looking at iDataSort but i'm not sure if that will work better than aDataSort
[code]
oTable = $('#tMain').dataTable({
"bProcessing": true,
"bServerSide": true,
"iDisplayLength": 100,
"sAjaxSource": path + "ajax/ajaxGetSentData",
"sServerMethod": "POST",
"aaSorting": [[2, 'asc']],//default sort
"sDom": "<'row'<'span3'><'span5'>r><'row'<'span3'i><'span5'p>>t<'row'<'span3'i><'span4'p>>",
"sPaginationType": "bootstrap",
"bStateSave": true,
"bAutoWidth": false,
"fnServerParams": function (aoData) {
aoData.push({ "name": "isAnalyst", "value": qs["isAnalyst"] });
aoData.push({ "name": "groupNo", "value": allGroups });
aoData.push({ "name": "BatchDt", "value": BatchDt });
aoData.push({ "name": "Batchid", "value": Batchid });
},
"aoColumnDefs": [
{ "aDataSort": [2, 3,10], "aTargets": [2] },
{ "aDataSort": [3,2,10], "aTargets":[3]},
{ "bVisible": false, "aTargets": [/*10,*/ 11, 14] }], //for database and testing purposes only
"aoColumns": [
{ "sName": "PolicyNo", "mData": "PolicyNo" },
{ "sName": "SSN", "mData": "SSN" },
{ "sName": "LNm", "mData": "LNm" },
{ "sName": "FNm", "mData": "FNm" },
{ "sName": "DOB", "mData": "DOB" },
{ "sName": "PolicyIssueDt", "mData": "PolicyIssueDt" },
{ "sName": "PolicyPaidToDt", "mData": "PolicyPaidToDt" },
{ "sName": "PolicyIssueSt", "mData": "PolicyIssueSt" },
{ "sName": "SystemCd", "mData": "SystemCd" },
{ "sName": "ResultCount", "mData": "ResultCount" },
{ "sName": "PolicyBatchid", "mData": "PolicyBatchid" },
{ "sName": "BatchDt", "mData": "BatchDt" },
{ "sName": "MatchScore", "mData": "MatchScore" },
{ "sName": "AnalystGrpNo", "mData": "AnalystGrpNo" },
{ "sName": "MatchReviewed", "mData": "MatchReviewed"}
],
[/code]
last name then first name then policy batch id when last name is sorted
first name then last name then policy batch id when first name is sorted
first and last name seem to sort correctly but PBID does not when i have records with the same last name and first name if doesn't seem like there is any order to them.
Normally the PBID column is hidden, i thought that was the problem but even un-hiding it did not work.
I've been looking at iDataSort but i'm not sure if that will work better than aDataSort
[code]
oTable = $('#tMain').dataTable({
"bProcessing": true,
"bServerSide": true,
"iDisplayLength": 100,
"sAjaxSource": path + "ajax/ajaxGetSentData",
"sServerMethod": "POST",
"aaSorting": [[2, 'asc']],//default sort
"sDom": "<'row'<'span3'><'span5'>r><'row'<'span3'i><'span5'p>>t<'row'<'span3'i><'span4'p>>",
"sPaginationType": "bootstrap",
"bStateSave": true,
"bAutoWidth": false,
"fnServerParams": function (aoData) {
aoData.push({ "name": "isAnalyst", "value": qs["isAnalyst"] });
aoData.push({ "name": "groupNo", "value": allGroups });
aoData.push({ "name": "BatchDt", "value": BatchDt });
aoData.push({ "name": "Batchid", "value": Batchid });
},
"aoColumnDefs": [
{ "aDataSort": [2, 3,10], "aTargets": [2] },
{ "aDataSort": [3,2,10], "aTargets":[3]},
{ "bVisible": false, "aTargets": [/*10,*/ 11, 14] }], //for database and testing purposes only
"aoColumns": [
{ "sName": "PolicyNo", "mData": "PolicyNo" },
{ "sName": "SSN", "mData": "SSN" },
{ "sName": "LNm", "mData": "LNm" },
{ "sName": "FNm", "mData": "FNm" },
{ "sName": "DOB", "mData": "DOB" },
{ "sName": "PolicyIssueDt", "mData": "PolicyIssueDt" },
{ "sName": "PolicyPaidToDt", "mData": "PolicyPaidToDt" },
{ "sName": "PolicyIssueSt", "mData": "PolicyIssueSt" },
{ "sName": "SystemCd", "mData": "SystemCd" },
{ "sName": "ResultCount", "mData": "ResultCount" },
{ "sName": "PolicyBatchid", "mData": "PolicyBatchid" },
{ "sName": "BatchDt", "mData": "BatchDt" },
{ "sName": "MatchScore", "mData": "MatchScore" },
{ "sName": "AnalystGrpNo", "mData": "AnalystGrpNo" },
{ "sName": "MatchReviewed", "mData": "MatchReviewed"}
],
[/code]
This discussion has been closed.
Replies
Sorting is being done by the server-side script (ajaxGetSentData) so it will be that which is responsible for doing the multicolumn sort.
Allan