Okay
  Public Ticket #1000068
Auto hide empty columns?
Closed

Comments

  •  2
    Frank started the conversation

    Is there way to automatically hide empty columns on first load?

  • [deleted] replied

    Hi Frank,
    Thank you for your purchase.

    Unfortunately something like this is not possible without custom coding. You can take a look at this solution how it can be achieved - Link

  •  2
    Frank replied

    Looks interesting, thanks. Where should data tables plugin code be placed within your plugin? In its own js file under plugins/wpdatatables/assets/js/wpdatatables? And where could I put the initialization code so that it does not get overwritten on plugin updates?

  • [deleted] replied

    Hi Frank,

    You can put your custom JavaScript code in wpDataTables Custom JS field on wpDataTables settings page. Like that changes will not be overwritten with plugin update.

    Also you can create WordPress Custom template and include new JavaScript file where you can add your custom code. Later you can use that WordPress Custom template on specific pages.

  •  2
    Frank replied

    Ok, I went with the settings page method and inserted the code from your link. It does not work and gives console error:

    Uncaught SyntaxError: Unexpected token :

    for the line at the end:

    "fnInitComplete": function () {
  • [deleted] replied

    Hi Frank,

    You can't copy whole code and past it. It is just an example how it can be done. It should be modified by you table and wpDataTable plugin. Something like that requires little custom coding.

  •   Frank replied privately
  • [deleted] replied

    Hi Frank,

    You can try to use datatables initComplete callback - https://datatables.net/reference/option/initComplete because we don't how our own callback that will work on table initialization.

  •  2
    Frank replied

    Ok, thanks, you can close the ticket.