How to file bug

How to file bug

djmdjm Posts: 20Questions: 4Answers: 0
edited September 2014 in Free community support

How can I file a bug?

When I go to
https://datatables.net/forums/categories/bug-reports
no matter what I only have the option to set "free community support" in the drop down menu.
How do submit a bug report?

Replies

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin

    You can do so in the free community support forums as well. I monitor it as well. Just post it in this thread for example.

    Please ensure that you include a test case with your bug report.

    Allan

  • djmdjm Posts: 20Questions: 4Answers: 0
    edited September 2014

    The problem is dynamically hiding/showing columns and synchronising this with ColVis as mentioned here:

    http://datatables.net/forums/discussion/23049/how-to-get-colvis-menu-to-update-when-i-dynamically-hide-show-columns#latest

    After further investigation I see that this is probably more of a misunderstanding on my part. Nonetheless here my current understanding and problem:

    I created a page based on the example

    http://www.datatables.net/release-datatables/extensions/ColVis/examples/simple.html

    Additionally I add this button to the html

    <button id="tst" > tst </button>
    

    (Clicking the button should hide a column, and then opening the ColVis dialog should show the corresponding checkbox unseleced)

    and this is what my js looks like:

    <script>
      
       $(document).ready(function() 
       {
          
          $('#tst').on( 'click',  function () 
             { 
                var table = $('#example').dataTable();
                table.fnSetColumnVis( 2, false );
                $.fn.dataTable.ColVis.fnRebuild( table );
             }
          );
          
          
          $(document).ready( function () {
             var table = $('#example').DataTable( {
            "sDom": 'C<"clear">lfrtip'
             } );
        
           } );
          
    } );
    
    </script>
    

    Everything seems to work fine.

    However if I instead use "var table = $('#example').DataTable();"
    then the function nSetColumnVis cant be found.
    If I use


    var table = $('#example').DataTable(); table.column(2).visible(false);

    then things work again but now

            $.fn.dataTable.ColVis.fnRebuild( table );
    

    wont work.

    http://datatables.net/manual/api
    mentions the difference between dataTable() and DataTable(), but its still unclear to me in particular in light of this example.

    I understood that "DataTable()" is the new recommended way to go, but that it was still analogous to using dataTable()? Why cant I get the example to work with it?
    Can you please clarify the difference some more, and explain how I would get this ColVis example to work with it.

    P.S
    I tried to get the code snippets shown in markup (down) cleanly as described
    http://datatables.net/manual/tech-notes/8
    but it doesnt seem to show properly. Am I doing something wrong?

    Thanks very much in advance.

  • djmdjm Posts: 20Questions: 4Answers: 0

    Heres a jfiddle with the above code:

    http://jsfiddle.net/b8xn0j12/

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    edited September 2014

    I understood that "DataTable()" is the new recommended way to go, but that it was still analogous to using dataTable()?

    In terms of the options passed in they are identical. The difference is in the return value. $().dataTable() will return a jQuery object extended with the old API. $().DataTable() will return the new DataTables API object.

    fnSetColumnVis exists only in the old API. In the new API you would want to use column().visible().

    Allan

  • djmdjm Posts: 20Questions: 4Answers: 0

    Thank you for the reply.
    So how could I get

    $.fn.dataTable.ColVis.fnRebuild( table );
    to work with DataTable ?

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin

    You wouldn't - the function you mention is a static function. Just call $.fn.dataTable.ColVis.fnRebuild( table );.

    There is an instance method called fnRebuild as well and for that you would need to access the ColVis instance, which you can do using the new method to create the ColVis instance and storing the variable as you would for any other constructor.

    I do need to update ColVis to add a 1.10 API extension method.

    Allan

  • djmdjm Posts: 20Questions: 4Answers: 0
    edited September 2014

    Thanks again for the reply
    What I meant is what if "table" was created with "DataTable"?
    Theres no way to call
    $.fn.dataTable.ColVis.fnRebuild( table )
    passing it as a parameter then?

    So Id have to do something like

                var table = $('#example').DataTable();
                 ...... // use "DataTable" ie "table" generally because its recommended over "dataTable()"
    
               table.column(2).visible(false);
    
               var table2 = $('#example').datatable();
    
               ... // no way to use "table" created with "DataTable" here
              $.fn.dataTable.ColVis.fnRebuild( table2 );
    
  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    edited September 2014

    I see - this is why a test case is an important part of filing a bug :-). I've created one here: http://live.datatables.net/sorodepe/1/edit . And yes that is a bug - it should work and isn't. I'll try to take a look and fix it as soon as I can.

    edit I see you do have a test case above, but the error code is commented out which is why I didn't see it before.

    Allan

  • djmdjm Posts: 20Questions: 4Answers: 0

    Thanks very much

  • djmdjm Posts: 20Questions: 4Answers: 0

    Thank you very much

  • djmdjm Posts: 20Questions: 4Answers: 0

    Thank you very much

This discussion has been closed.