l-lin / angular-datatables

DataTables with Angular
https://l-lin.github.io/angular-datatables/
MIT License
1.57k stars 486 forks source link

How to listen for colReorder event on Angular? #1630

Closed flamurbeqiraj closed 2 years ago

flamurbeqiraj commented 2 years ago

Im using Angular 12+, trying to get the actual order of colReorder event. When I use it with jQuery everything works great, I just can't make it work without jQuery?

What is the alternative of this for angular?:

 table.on("column-reorder", function () {
   localStorage.setItem("mandanten", JSON.stringify(table.colReorder.order()));
 });

this.dtOptions = { colReorder: { enable: true, realtime: false, order: cols } }

Please some documentation would be awesome, the only thing what you can see on the documentation is how to enable colReorder, but not how to get the current state or set a specific order.

shanmukhateja commented 2 years ago

Hi,

This library is an Angular wrapper for jQuery datatables.net plugin. As far as I know, there is no other way to access events without jQuery.

You can try creating a custom Angular component and "shim" the jQuery logic inside it via EventEmitter and Output to fetch states, etc.