Table data sometimes apear when columns are hidden

Table data sometimes apear when columns are hidden

TristanLGTristanLG Posts: 3Questions: 1Answers: 0
edited September 2017 in Free community support

Hello,
Sometimes, when i redraw datatable through API, or refreshing my page, i can see column datas rendered from hidden columns (see the picture, the 2 last columns should not apear).

Exemple

Below, my configuration :

//Cols are initiated properly, with the 3 following attributes : name, orderable, visible

var table = $("#myTable);
table.dataTable({
                "autoWidth":    false,
                "processing":   false,
                "serverSide":   true,
                "pageLength":   15,
                "className":    'data-title',
                "ajax": 'my-link-to-ajax.php',
                "columns": cols,
                "order": [1, 'desc'],
                "pagingType": 'full_numbers',
                "drawCallback": function() {
                    redrawLabels();
                }
            });

Can you help me :smile: ?

Answers

  • TristanLGTristanLG Posts: 3Questions: 1Answers: 0

    Someone ?

  • Tester2017Tester2017 Posts: 145Questions: 23Answers: 17

    Maybe you can define your table with class 'hidden' and as soon the document is loaded remove the hidden class, that way during load nothing is shown.

    I do this with forms, like this:

        <div id="customForm" class="hidden">
    
    $(document).ready(function() {
                /*
                Remove class 'hidden' from customForm so
                it will be visible when a form action is needed.
                 */
                $("#customForm").removeClass('hidden');
    
  • allanallan Posts: 63,468Questions: 1Answers: 10,466 Site admin

    Can you link to a test case showing the issue rather than a screenshot please?

    Allan

  • TristanLGTristanLG Posts: 3Questions: 1Answers: 0

    I don't know how to produce case test using ajax source :(
    But i also guess that it can be due to one of my script using td for other purposes...
    Thanks for your answers, i'll try to figure it out.

    If it is due to dataTable i'll come back and post my answer

This discussion has been closed.