Hi,
I am trying to show/hide columns in the datatable using the state information stored in a database.
When the user hides few columns, and saves the information in the database using some profile name.
Later, when the user selects one of the saved profile names, from a dropdown, I need to -
1. Load the new state information from the database. How can I trigger the load state event?
2. How can I update the table with state information
I am able to do the save information. However, I am having trouble loading the saved state information.
I am using jquery.dataTables.js 1.10.6
stateLoadCallback: function (settings) {
var o;
//Get the selected profile name from the drop-down
var profile_value = $("#selected_profile_name" ).val();
if(profile_value != null){
var url = "/state/"+user_name+"/"+table_id+"/profile1";
$.ajax({
"url": url,
"dataType": "json",
"type": "GET",
"async":false
}).done(function ( data ) {
o = JSON.parse(data);
console.log('In done of stateLoadCallback'+data);
}).fail(function ( data ) {
console.log('In fail of stateLoadCallback'+data);
});
return o;
}
}
Thanks