Client sorting on wrong index

Client sorting on wrong index

noirnoir Posts: 1Questions: 1Answers: 0

i used "sAjaxSource" to get data from server, and server will response with aaData i.e:
[{"id":"1", "username":"admin", "role":"Administrator"}].

In client side, i set aoColumns:
[{ mDataProp: "username"},
{ mDataProp: 'role'},
{ mDataProp: 'id'}]

Then when the table header clicked to sorting the column, it will sort on wrong column index. for example :
click header field "role" (index 1 in client table) then it will sorted by "username" (index 1 in data source).

how to solve this problem other than i have to make sure the fields order are the same in data source and client table?

This discussion has been closed.