Buttons no longer visibile using Foundation and translation

Buttons no longer visibile using Foundation and translation

FicosFicos Posts: 85Questions: 21Answers: 0

Link to test case:
https://debug.datatables.net/ipedub
Error messages shown: none
Description of problem: when adding this script the Buttons are no longer visible

$.extend(true, $.fn.dataTable.defaults, {
            language: {
                'url': 'https://cdn.datatables.net/plug-ins/1.12.1/i18n/nl-NL.json'
            }
        });

I am new to Foundation and wondering why this behaviour happens, Any way to solve the problem?
Thanks,
Jan

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    Hi Jan,

    The language.url option makes the table initialisation async. So it isn't ready when this code in the table.datatables_demo.js file fires:

        new $.fn.dataTable.Buttons( table, [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ] );
    
        table.buttons().container()
            .appendTo( $('.small-6.columns:eq(0)', table.table().container() ) );
    

    You need to move that code into an initComplete callback.

    Allan

  • FicosFicos Posts: 85Questions: 21Answers: 0

    Thanks Allan,
    I am sorry, adding this

    initComplete: function (settings, json) {
                $.extend(true, $.fn.dataTable.defaults, {
                    language: {
                        'url': 'https://cdn.datatables.net/plug-ins/1.12.1/i18n/nl-NL.json'
                    }
                });
              },
    

    doesn't change the behavior (still no buttons visible). Did I misunderstood you?
    Jan

  • FicosFicos Posts: 85Questions: 21Answers: 0

    that is: buttons are visible but translation fails :smile:

  • kthorngrenkthorngren Posts: 20,145Questions: 26Answers: 4,736
    Answer ✓

    I think Allan was saying to move this code into initComplete:

    new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ] );
     
    table.buttons().container()
        .appendTo( $('.small-6.columns:eq(0)', table.table().container() ) )
    

    Kevin

  • FicosFicos Posts: 85Questions: 21Answers: 0

    yes, thanks.
    a suggestion might be that in Generator the initComplete contains the buttons, currently they don't

Sign In or Register to comment.