Skip to content

ColResize fnReset gives an error - is enable/disable resize possible? #33

Description

@azCool

Hi there

I want to enable/disable column resizing on a datatable as we have an edit and cancel button to toggle this functionality on and off.

So far I have only been able to do this as follows:

  1. on datatable initialise, exclude columns from resize - this works

       "colResize": {
         "exclude": [0, 1, 2]
       },
    
  2. In our edit button click event, use the api to allow all columns to resize - this works

var table = $('#dataTableSites').DataTable();

new $.fn.dataTable.ColResize(table, {
"exclude": []
});

  1. In our cancel button click event, try to disable the resize again - both these fail

var table = $('#dataTableSites').DataTable();
new $.fn.dataTable.ColResize(table, {
"exclude": [0,1,2]
});

new $.fn.dataTable.ColResize(table).fnReset();

this gives the following error:
Uncaught TypeError: this.s.dt.adjust is not a function
at ColResize.fnReset (dataTables.colResize.js:216)

Can anyone help?

regards
Az

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions