Can i reset aoColumns after initialization of datatable..

Can i reset aoColumns after initialization of datatable..

cloudnixcloudnix Posts: 15Questions: 0Answers: 0
edited April 2012 in DataTables 1.8
I have my datatable with Edit button with it. What i want is to hide the Edit button if the user click the save button. I tried using this:
[code]
oTblPODet.dataTable('option', { "aoColumns": [{ "bVisible": false }, { "bVisible": false }, { "bVisible": false }, null, null, null, null, { "bVisible": false}] });
[/code]
But it did not work..

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    No - DataTables does not currently allow for dynamic reconfiguration of tables list that. However, given that it looks like you just want to change the visible of a few columns use the fnSetColumnVis API method - it will be a _lot_ faster than reinitialising a table.

    Allan
  • cloudnixcloudnix Posts: 15Questions: 0Answers: 0
    Thanks!! That works..
  • cloudnixcloudnix Posts: 15Questions: 0Answers: 0
    Hi allan.. I have a problem now regarding this.. im using asp.net, when my page postbacks, the hidden column becomes visible again..
  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Can you link to your page please?

    Allan
  • cloudnixcloudnix Posts: 15Questions: 0Answers: 0
    im sorry but i cant link you to the page. but in my code, i place the fnSetColumnVis in a button, then the button executes a server side codes so it needs postback. But after the postback, the hidden columns are visible again.. The same thing happens for columns hidden by ColVis.
  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Are you replacing the whole table with your Ajax update? That would destroy the old DataTable...

    Allan
  • cloudnixcloudnix Posts: 15Questions: 0Answers: 0
    im not using ajax to fill the table. i'm using asp:Repeater instead.. so i guess i'm not creating new datatable..im not sure though because i'm a beginner developer..
This discussion has been closed.