Csv button not showing

Csv button not showing

mgimgi Posts: 14Questions: 6Answers: 1
edited January 2018 in Free community support

Hi, I have defined following table but somehow export to csv button is not showing.

         var dom = "<'row'<'col-sm-2'l><'col-sm-6'B>>"
            + "<'row'<'col-sm-12'tr>>"
            + "<'row'<'col-sm-5'i><'col-sm-7'p>>";

    var buttons = [ 
                {extend : 'create', editor : editor},
                {extend : 'remove', editor : editor},
                'selectAll', 'selectNone', 'colvis', 'colvisRestore', 'csv'];

           var dt = $wnd.$(el).DataTable({
        columns : columns,
        ajax : {
            url : apiEndpoint
        },
        dom : dom,
        processing : true,
        serverSide : true,
        select : {
            style : 'os'
        },
        buttons : buttons,
    });

I tried to create custom button and in onClick function call

             $wnd.$(e).DataTable.ext.buttons.csv.action.call(this, e, dt, button, config);

but i got OperatorsView.java:175 Uncaught TypeError: Cannot read property 'call' of undefined

I am using DataTables 1.10.13 and Buttons 1.2.3

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    I suspect you want to use:

    $wnd.$.fn.DataTable.ext.buttons.csv.action.call(this, e, dt, button, config);
    

    assuming that $wnd is your window object?

    Allan

  • mgimgi Posts: 14Questions: 6Answers: 1

    still same error,
    $wnd is window object, I am using datatables with GWT,

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Can you link to the page so I can take a look and see what the problem is please?

    Allan

  • mgimgi Posts: 14Questions: 6Answers: 1

    I manged it with custom button and REST

This discussion has been closed.