Table Header

Table Header

Andreas S.Andreas S. Posts: 208Questions: 74Answers: 4

Hi,

When I click on a link to see a data table, the complete title line is displayed first. With the columns which are supposed to be invisible.
I think the users are confused when they first see the complete title line.
Is it possible to prevent this?

Andreas

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    I use the DataTables columnDefs option to hide columns:
    https://datatables.net/reference/option/columnDefs

    Kevin

  • Andreas S.Andreas S. Posts: 208Questions: 74Answers: 4

    I use this function, but in the fist step, datatable load the data, I see all headers. After all data loaded, the invisible rows are removed.

    Andreas

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    Sounds like there is a delay between the web page being loaded and the DataTable initialization. Do you have other code executing before initializing the table?

    If you have the JS in a separate file there may be a delay in loading it.

    You may need to provide a link to your page for troubleshooting.

    Kevin

  • ko01uko01u Posts: 1Questions: 0Answers: 1
    Answer ✓

    I do it this way. In Html set the Table hidden:

    <

    table class="table table-striped table-bordered table-hover pageResize hidden" id="personTable" cellspacing="0" width="100%" style="background: #EEEEEE">

    after initialization remove the hidden class:
    $('#personTable').DataTable({
    initComplete: function () { $('#personTable').removeClass('hidden'); }
    });

    regards
    Uli

  • Andreas S.Andreas S. Posts: 208Questions: 74Answers: 4

    Perfect, Thanks this works.

    Regards
    Andreas

This discussion has been closed.