Save layout of data including sorting,column width,Hide/Show etc.
Save layout of data including sorting,column width,Hide/Show etc.
Hi,
I am using server side processing with scroller, check box for hide/show column.
My code:
var oTable = $('#example').dataTable( {
"sScrollY": "150px",
"sAjaxSource": "/ExampleDataTableJSON/FeedServlet",
"bServerSide": true,
"sDom": "RfrtiS",
"oScroller": {
"loadingIndicator": true
},
"aoColumns": [
{ "mData": "engine" },
{ "mData": "browser" },
{ "mData": "platform"},
{ "mData": "version"},
{ "mData": "grade"}
]
} );
I want to store existing layout(JSON) into database(Including Sorting,Column width and Hide/Show column) ,can anyone help me by giving any example.
I have tried fnServerData but i am not able to figure out whats happening.
Thanks
Sam
I am using server side processing with scroller, check box for hide/show column.
My code:
var oTable = $('#example').dataTable( {
"sScrollY": "150px",
"sAjaxSource": "/ExampleDataTableJSON/FeedServlet",
"bServerSide": true,
"sDom": "RfrtiS",
"oScroller": {
"loadingIndicator": true
},
"aoColumns": [
{ "mData": "engine" },
{ "mData": "browser" },
{ "mData": "platform"},
{ "mData": "version"},
{ "mData": "grade"}
]
} );
I want to store existing layout(JSON) into database(Including Sorting,Column width and Hide/Show column) ,can anyone help me by giving any example.
I have tried fnServerData but i am not able to figure out whats happening.
Thanks
Sam
This discussion has been closed.
Replies
One addition in my above comments, I wanted to save layout on button click.
Thanks
Sam
Allan
Thank you for your suggestion. I will manage column width later but right now i am using:
fnStateSave": function (oSettings, aoData ) {}
When alert aoData I got Something like this:
alert("aoData" +JSON.stringify(aoData));
Output:
aoData{"iCreate":1383133868178,"iStart":0,"iEnd":0,"iLength":63,"aaSorting":[[0,"asc",0]],"oSearch":{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},"aoSearchCols":[{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true},{"bCaseInsensitive":true,"sSearch":"","bRegex":false,"bSmart":true}],"abVisCols":[true,true,true,true,true],"iScroller":0,"ColReorder":[0,1,2,3,4]}
I need Sortorder, SortName, ColName, ColModel
What is my scenario let me clear Allan, My current application is using jqgrid i am trying to replace with datatable.
I am saving layout by converting JSON to XML and using AJAX to store layout in database
jqgrid gives me Sortorder, SortName, ColName, ColModel directly
e.g var colNames = $("#ID").jqGrid('getGridParam','colNames');
I can apply same logic if i get all this values using aoData or in some other way.
I request you to suggest me some solution for this.
Thanks
Sam