Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
function initGrid() {
    oTable = $('#grid').dataTable({
        'bProcessing': false
		, 'bFilter': false
		,'bSort': true                   
		, 'bPaginate': false
		, 'bServerSide': true
		, 'iDisplayLength': -1
       ,'orderFixed': [ 0, 'asc' ]
	//	, 'aaSorting':  [[1, "asc"]]
		//,'aaSortingFixed': [[1, 'asc']]        
		, 'sAjaxSource': 'XYZ.aspx/ABCDE'
		, 'fnServerData': function (sSource, aoData, fnCallback) {
		    $.ajax({
		        'dataType': 'json'
				, 'contentType': 'application/json;'
				, 'type': 'POST'
				, 'data': "{ consultorId: '" + selectedConsultor + "' }"
				, 'url': sSource
				, 'success': function (msg) {
				    oTableInitialized = true;
				    drawGrid(msg);
				    $('.listContent').jScrollPane({ showArrows: false });
				}
				, 'error': function (msg) { onError(msg); }
		    });
		    
		}
		 //,'aaSortingFixed': [[1, 'asc']]       
    });
}
Posted
Updated 2-Feb-16 3:41am
v5
Comments
Member 12302750 2-Feb-16 9:12am    
I am trying to sort the datatable with first column (descending) but it fails. Please suggest whats wrong I am doing here.

Thanks in advance !!
John C Rayan 2-Feb-16 9:35am    
what error are you getting?

1 solution

Because your first column order is fixed.

'orderFixed': [ 0, 'asc' ]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900