Error, Table.button is not a function, when using dot notation

Error, Table.button is not a function, when using dot notation

BricobitBricobit Posts: 1Questions: 0Answers: 0

Following my preferences for classes, for clarity I feel more comfortable working with point notation instead of nesting properties within an object but it doesn't work, it tells me that buttons is not a function.

The code I am using is as follows:

this._jqTable= $('#'+this.objElement.id).DataTable();

    let obj1Custom = new Object();
    obj1Custom.extend = 'selectedSingle';
    obj1Custom.text = 'Select';
    obj1Custom.action = onSelectRow;

    this._jqTable.lengthChange  = false;
    this._jqTable.select = true;
    this._jqTable.buttons = ['copy', 'excel', 'pdf', 'colvis','pageLength',obj1Custom];
    this._jqTable.aLengthMenu = [[5, 10, 25,50,100, -1], [5, 10, 25,50,100, "All"]];

    this._jqTable.buttons().container().appendTo('#'+this.objElement.id+'_wrapper .col-md-6:eq(0)');

    function onSelectRow ( e, dt, button, config ) {
          console.log( dt.row( { selected: true } ).data() );
    }

I have also tried the following, the error disappears but still does not work.

     this._jqTable.buttons(['copy', 'excel', 'pdf', 'colvis','pageLength',obj1Custom]);

Replies

  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin

    Can you give me a link to a page showing the issue please?

    Thanks,
    Allan

This discussion has been closed.