Save state and data-visible="false"

Save state and data-visible="false"

anzerkreeanzerkree Posts: 2Questions: 1Answers: 0

Hello,

I have a table with columns that I want to hide by default using the data attribute data-visible="false".

        <thead>
            <tr>
                <th data-exclude="true" data-width="50"></th>
                <th data-orderable="false" >Col 2</th>      
                <th data-visible="false" >Col 3</th>        
            </tr>
        </thead>

Everything works fine until I enable stateSave: true in my DataTable configuration.

var table = $(tableIdentifier).DataTable({
        data: datas,
        stateSave: true,
....

At that point, the data-visible attribute is no longer considered, and all columns become visible.

Is there a way to make both work?

That is, if no state exists, use the data attribute and otherwise override it with what's stored in memory?

Answers

Sign In or Register to comment.