Need to store column view to database per user after show/hide functionality
Need to store column view to database per user after show/hide functionality
Hello
Thanks for great work! I am using datatable colVis for show/hide columns.In my application ,I have a requirement to store column names (the columns user selects as visible) to database for each user.I need to store the visible column names to database and present the user with the same set of columns on search after successive logins.I have used the following code snippet to send table state to servlet :
"stateSaveCallback": function (oSettings, oData) {
$.ajax( {
"url": "save.do",
"data": oData,
"dataType": "json",
"method": "POST",
"success": function () {}
} );
// alert (" save called");
},
But the problem is I am not getting the column names in request of the servlet.
Above isssue aside ,i have a question:
I only want to store the column names to database for each user and then i want to show datatable with only those 'visible' column names i saved earlier for user after each successive login.It is possible?
Please guide on these.
Answers
iam not 100% sure but this could be used to get columns names .$.fn.getColumnsShown = function(dTable)
{
vCols = new Array();
That looks like it is about the only approach at the moment. I don't normally recommend using fnSettings at all, but there is no other way to access the column names at this time.
Are column indexes not good enough here?
Allan