Serverside processing with orderdata
Serverside processing with orderdata
I'm a new user with datatables and I'm setting it up with server side processing to handle paging. I have a table that includes a forename and surname so I've defined the columns such that the ordering of the names is linked e.g.
"columns": [
{
"data": "username",
"title": "User name",
},
{
"data": "forename",
"title": "First name",
"orderdata": [1, 2]
},
{
"data": "surname",
"title": "Last name",
"orderdata": [2, 1]
}
]
(There are actually more "related columns such as department and status but I've simplified)
When the data is sent to the ajax hander after clicking on the forename header the order parameter only contains one entry for column 1 (similarly for surname, only one entry for column 2). I was expecting the parameter to contain two sets of column information to indicate the required secondary sort that I'd then use building my database query.
Using shift click to explicitly select multiple columns for sorting does pass multiple column information but it doesn't seem to take account of the predefined orderdata settings.
Is t his just a wrong assumption on my part or should the ajax handler be getting two sets of column information? The "linked sorting" seems to work in all the site example pages, but they're not driven by server side information.