Uncaught Buttons: Too many iterations

Uncaught Buttons: Too many iterations

JbocookJbocook Posts: 6Questions: 3Answers: 0

http://debug.datatables.net/axomet

Not sure why I'm getting this error. I've searched the forums and google and have come up empty handed. When we try to add buttons to the form we get Uncaught Buttons: Too many iterations

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,053 Site admin

    Hi,

    Thanks for the debug trace. The trace shows that you are using Editor 1.4.2, but the create etc buttons require Editor 1.5.0+ as they were introduced in that version of Editor.

    The error shouldn't be "too many iterations", instead complaining about an unknown button type - I will look into that, but you need to upgrade your Editor if you want to use Buttons.

    Allan

  • JbocookJbocook Posts: 6Questions: 3Answers: 0

    I updated to 1.5.0 and I receive the same error. I followed the example placing the same code on the page. If I remove buttons.js and the call in the table js the site gives me no errors.

  • allanallan Posts: 61,446Questions: 1Answers: 10,053 Site admin

    Could you possibly give me a link to your page? There must be some difference to the demo, since the demo works.

    Thanks,
    Allan

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    I have the same issue. I have used the download page to set up the include section.

    ty
    f

  • JbocookJbocook Posts: 6Questions: 3Answers: 0

    I can't send a link, it's internal but here's a zip of the directory. It's a demo I before including into a project.

    https://www.wetransfer.com/downloads/09385e3b4fc9295c3de29f63c369d84120150814210758/b78cf9

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    If you need an easy way ro reproduce the bug this is my code.

    This code gives the bug.

    if you remove the section

    buttons: [
                { extend: "create", editor: editor },
              { extend: "remove", editor: editor }                  
             
            ], // buttons
    

    the bug disappears

    <?php include('_header.php'); ?>
    
    <link rel="stylesheet" type="text/css" href="Bootstrap-3.3.5/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="DataTables-1.10.8/css/dataTables.bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="Buttons-1.0.0/css/buttons.bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="Editor-1.5.0/css/editor.bootstrap.css"/>
     
    <script type="text/javascript" src="jQuery-2.1.4/jquery-2.1.4.js"></script>
    <script type="text/javascript" src="Bootstrap-3.3.5/js/bootstrap.js"></script>
    <script type="text/javascript" src="DataTables-1.10.8/js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="DataTables-1.10.8/js/dataTables.bootstrap.js"></script>
    <script type="text/javascript" src="Buttons-1.0.0/js/dataTables.buttons.js"></script>
    <script type="text/javascript" src="Buttons-1.0.0/js/buttons.bootstrap.js"></script>
    <script type="text/javascript" src="Editor-1.5.0/js/dataTables.editor.js"></script>
    <script type="text/javascript" src="Editor-1.5.0/js/editor.bootstrap.js"></script>
    
    
        <div>
            <!-- Include Menu -->       
            <?php include('_menu.php'); ?>
            
            <div class="white_box">
                <h1><?php echo WORDING_MANAGE_SECTIONS ?></h1>
                <p><?php echo WORDING_MANAGE_SECTIONS_SUBTITLE ?></p>
                <br>
                
                <table id="sections" class="table table-striped table-bordered" cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th><?php echo WORDING_SECTION_TABLE_COLUMN_NAME ?></th>
                            <th><?php echo WORDING_SECTION_TABLE_COLUMN_COLOR ?></th>
                        </tr>
                    </thead>
                </table>
                
            </div>
            <br>
        </div>
        
        
        
        <!-- JAVASCRIPTS -->
        <script type="text/javascript">
        
        // Configure the editor for the inline editing
        editor = new $.fn.dataTable.Editor( {
            ajax: "_php/dtSections.php",
            table: "#sections",
            fields: [ {
                    label: "Section Name",
                    name: "name"
                }, {
                    label: "Color",
                    name: "color"
                }  
                ]
        } );
        
        // Activate an inline edit on click of a table cell
        $('#sections').on( 'click', 'tbody td:not(:last-child)', function (e) {
            editor.inline( this );
        } );
        
        // DataTable
        table = $('#sections').DataTable({
        
            ajax: "_php/dtSections.php",
            
            columns: [
                    { data: "name" },
                    { data: null, sClass: "alignCenter", orderable: false, editField: "color", width: "20%",
                            render: function ( data, type, full ) {
                                return '<button class="btn btn-default colorPicker" id="' + data.id 
                                + '" style="background-color:' 
                                + data.color +'">Change</button>';
                            } // render 
                    } // data 
            ],
                                
            aLengthMenu: [[5, 10, 25], [5, 10, 25]],
            pageLength: 5,
            select: true,
            
            buttons: [
                { extend: "create", editor: editor },
              { extend: "remove", editor: editor }                  
             
            ], // buttons
    
        });
        
        </script>
        
    
    <?php include('_footer.php'); ?>
    

    end

  • JuasmasJuasmas Posts: 1Questions: 0Answers: 0

    Hi!

    I had the same issue and I've solved it by downloading and including the "select-1.0.0" extension files in my code.

    Hopefully this will also work for you,

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    Yeah! Fixed thanks.

    Fabio

  • shinokshinok Posts: 7Questions: 2Answers: 0

    The error happens if you use or rather try to use a button for which you havent downloaded the js file. I tried to use the colVis button but had forgotten to include itse js file and got the same error.

  • allanallan Posts: 61,446Questions: 1Answers: 10,053 Site admin

    Interesting - what should happen is that you get an error such as "Uncaught Unknown button type: colvis" which is what I got when I just tried it.

    Could you do me a favour and link to your page that shows this issue so I can see why that catch code isn't working in this case.

    Thanks,
    Allan

  • calacala Posts: 52Questions: 15Answers: 0
    edited September 2015

    Hi to everybody!

    I have the same issue, I've included
    https://cdn.datatables.net/select/1.0.1/js/dataTables.select.js
    as @Juasmas said, but nothing changed.

    Select function is working (I can select a row and also the infos under the table are updated) but, if I debug the dataTable it says that Select is not installed (http://debug.datatables.net/igozus )

    Thanks for the help!

  • allanallan Posts: 61,446Questions: 1Answers: 10,053 Site admin

    Can you link to the page showing the issue so I can debug it please.

    Allan

  • JbocookJbocook Posts: 6Questions: 3Answers: 0

    Alley I can't link to the page, is on an internal development server. I believe the issue was with datatools, Datatables must have switched from datatools a few days after we purchased and downloaded the library.

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited October 2015

    I have just experienced the same error message with buttons, - but they work fine with the select extension

  • allanallan Posts: 61,446Questions: 1Answers: 10,053 Site admin

    Can you link to the page so I can debug the issue? Also make sure that you don't have a trailing comma in your buttons array - I've seen that cause issues as it makes it look like there is an undefined button.

    Allan

This discussion has been closed.