{"action":"closed","issue":{"url":"https://api.github.com/repos/l-lin/angular-datatables/issues/83","labels_url":"https://api.github.com/repos/l-lin/angular-datatables/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/l-lin/angular-datatables/issues/83/comments","events_url":"https://api.github.com/repos/l-lin/angular-datatables/issues/83/events","html_url":"https://github.com/l-lin/angular-datatables/issues/83","id":44099083,"number":83,"title":"Data Reload with Promise leads to showing hidden columns and loss of Datatable autoformat column widths","user":{"login":"zachrybaker","id":276786,"avatar_url":"https://avatars.githubusercontent.com/u/276786?v=3","gravatar_id":"","url":"https://api.github.com/users/zachrybaker","html_url":"https://github.com/zachrybaker","followers_url":"https://api.github.com/users/zachrybaker/followers","following_url":"https://api.github.com/users/zachrybaker/following{/other_user}","gists_url":"https://api.github.com/users/zachrybaker/gists{/gist_id}","starred_url":"https://api.github.com/users/zachrybaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachrybaker/subscriptions","organizations_url":"https://api.github.com/users/zachrybaker/orgs","repos_url":"https://api.github.com/users/zachrybaker/repos","events_url":"https://api.github.com/users/zachrybaker/events{/privacy}","received_events_url":"https://api.github.com/users/zachrybaker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/l-lin/angular-datatables/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-09-26T19:41:55Z","updated_at":"2015-01-23T21:02:18Z","closed_at":"2015-01-23T21:02:18Z","body":"I am using the fixed header plugin, and specifying my column definitions on the controller side of things.\r\n\r\nI see that when I reload the data, everything gets real crazy.  Mainly my hidden column is no longer hidden, and I lose my column widths computed by dataTables.\r\n\r\nHere's my controller code:\r\n```js\r\n        R.reloadLeadsData = function() {\r\n            s.dtOptions.reloadData();\r\n        };\r\n\r\n        s.dtOptions = DTOptionsBuilder\r\n            .fromFnPromise(function() {\r\n                return R.leads.$promise;\r\n            })\r\n            .withOption('bPaginate', false)\r\n            .withOption('fnDrawCallback', function(){\r\n                $('.dataTables_filter input').attr(\"placeholder\", \"Search by Name, Account Name, Contact, Sielbel #, or Close Date\");\r\n            })\r\n            .withOption('fnInitComplete', function(settings, json){\r\n                var table = $('#myLeads').DataTable();\r\n                if ($('.FixedHeader_Cloned').length === 0){\r\n                    new $.fn.dataTable.FixedHeader( table, { \"offsetTop\": '88px'});\r\n                }\r\n            })\r\n            .withOption('rowCallback', function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {\r\n                .....\r\n            });\r\n\r\n        s.dtColumns = [\r\n            DTColumnBuilder.newColumn('Id').notVisible(),\r\n            DTColumnBuilder.newColumn(null).withTitle('Name').withClass('column-description')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<h4 class=\"leadName\">' + data.DynamicsLead.Description + '</h4><p>' + data.ContactName + '</p><p>' + \r\n                    '</p><p>Siebel #: ' + data.DynamicsLead.SiebelId + '</p>';\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Revenue').withClass('column-revenue')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '$' + currency(data.DynamicsLead.EstimatedRevenue);\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Lead').withClass('column-lead timeline-position')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<div class=\"place-wrapper\"><div class=\"place\">' + (data.LeadStatus === 0 ? '<div class=\"unconfirmed\"> </div>' : '')+ '</div></div>';\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Confirmed').withClass('column-confirmed timeline-position')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<div class=\"place-wrapper\"><div class=\"place\">' + (data.LeadStatus === 1 ? '<div class=\"confirmed\"><span>C</span></div>' : '')+ '</div></div>';\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Bid / Negotiate').withClass('column-bid timeline-position')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<div class=\"place-wrapper\"><div class=\"place\">' + (data.LeadStatus === 2  ? (data.DynamicsLead.SalesStageId == '100000003' ? '<div class=\"bid\"><span>N</span></div>' : '<div class=\"bid\"><span>B</span></div>' ): '')+ '</div></div>';\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Win / Loss').withClass('column-winloss timeline-position')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<div class=\"place-wrapper\"><div class=\"place\">' + (data.LeadStatus === 3 || data.LeadStatus === 4  ? '<div class=\"' + ( data.LeadStatus === 3 ? 'win\"><span>$</span> </div>' : 'loss\"><span>↓</span> </div>')  : '')+ '</div></div>';\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Close Date').withClass('column-closeDate')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return $filter('date')(data.closeDate, 'MMM d, yyyy');\r\n                }),\r\n            DTColumnBuilder.newColumn(null).withTitle('Status').withClass('column-status')\r\n                .renderWith(function(data, type, full, meta){\r\n                    return '<div class=\"lead-status-symbol ' + data.SubmissionClass + '\"></div><div class=\"submissionDesc\">' + data.SubmissionStatusDesc + '</div>';\r\n                })\r\n        ];\r\n```"}}