Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2366

How to sort columns on server side

$
0
0

We have a situation where i have 5 columns in the data table on a server side request, based on the users permissions we hide and show various columns based on their permission levels.

For instance an admin user can see all the columns [ AcctName, AcctPwd, DateCreated, LastUpdated, LastLogin]. For a normal user can we do not allow them to see the password column so they only see [AcctName, DateCreated, LastUpdated, LastLogin] and AcctPwd visible: false

When the user clicks on the sort column icon in the data table, we get the form values. We look for order[0][column] and order[0][dir] and then sort the data appropiately on the server side like your documention suggest.

However depending on the view the server_side is getting a 1 when the admin user clicks on AcctPwd, and we also get a 1 when the regular user clicks on the DateCreated column, and the column index is off from every other visible column after that. How can the server_side know which column 1 is actually pointing to? Is there a way we can get the column name on the server side to know they click on the AcctPwd or DateCreated column?

This also presents a problem when we change the JavaScript column order and forget to update the server_side ordering, having a name would be a hugh help, right now I really cannot sort the column data server_side without knowing the correct column.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 2366

Trending Articles