• Resolved eherring

    (@eherring)


    I’ve read through the documentation 100 times but cannot get the right configuration of the shortcode to make my last column not visible (but still there and searchable), I was able to do this by altering the default settings, but I have multiple charts across my site and cannot do this on a default level.

    Default code:

    {
    “dom”: “B<‘clear’>lfrtip”,
    “buttons”: [
    “colvis”,
    “copy”,
    “csv”,
    “excel”
    ],
    “pageLength”: 25,
    “columns”: [
    null,
    null,
    null,
    null,
    { “visible”: false }
    ]
    }

    Datatables code:

    $(‘#example’).dataTable( {
    “columns”: [
    null,
    null,
    null,
    null,
    { “visible”: false }
    ] } );
    } );

    Shortcode:
    [gdoc key=”https://docs.google.com/spreadsheets/d/1234546789/edit#gid=0&#8243; datatables_columns=”null, null, null, null, ‘{ ‘visible’: false }'”]
    [gdoc key=”https://docs.google.com/spreadsheets/d/1234546789/edit#gid=0&#8243; datatables_columns=”‘null’, ‘null’, ‘null’, ‘null’, ‘{ ‘visible’: false }'”]
    [gdoc key=”https://docs.google.com/spreadsheets/d/1234546789/edit#gid=0&#8243; datatables_columns=”[ null, null, null, null, { “visible”: false } ]”]
    [gdoc key=”https://docs.google.com/spreadsheets/d/1234546789/edit#gid=0&#8243; datatables_columns=”‘null’, ‘null’, ‘null’, ‘null’, { ‘visible’: false } ]”]

    And I’ve tried a few other variations as well but cannot figure it out

Viewing 1 replies (of 1 total)
  • Plugin Author Meitar

    (@meitar)

    datatables.columns is an array, which means you need to use [ and ] characters as the first and last characters in the datatables_columns attribute’s value. However, as this plugin’s FAQ mentions, the [ and ] character is reserved by WordPress to start and end a shortcode, so you must escape these characters, turning them into %5B and %5D, respectively.

    So:

    datatables_columns="%5B null, null, null, null, { "visible": false } %5D"
    
Viewing 1 replies (of 1 total)
  • The topic ‘How to instigate the shortcode for datatables_columns’ is closed to new replies.