Hiding column via columnDefs just won't work for me. I feel like I'm losing my mind.

Hiding column via columnDefs just won't work for me. I feel like I'm losing my mind.

gjchgjch Posts: 3Questions: 2Answers: 0

I'm trying to perform a simple column hide via columnDefs, exactly as is shown here in the first example, but for some reason it just won't work for me, and it's driving me a bit insane. It's such a simple thing and no matter what I try I can't get it working.

Does the columnDefs setting sometimes conflict with another setting? Am I missing something obvious here?

            "columnDefs": [
            { "visible": false, "targets": 0 }
            ],

My server-side processing script contains:

$columns = array(
    array( 'db' => 'id', 'dt' => 0 ),
    array( 'db' => 'name', 'dt' => 1 ),
    array( 'db' => 'number_of_servers', 'dt' => 2 )
);

And my HTML is (it's the ID column I'm trying to hide):

        <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Servers</th>
        </tr>
        </thead>

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @gjch ,

    Yep, that's all it needs, see here. Could you modify that example, or post a link to your page, so that we can see the problem.

    Cheers,

    Colin

This discussion has been closed.