l-lin / angular-datatables

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

Access underlying DataTable #564

Closed lianee closed 8 years ago

lianee commented 8 years ago

I'm using the RowReorder plugin of DataTables, which triggers a row-reorder event on the table:

http://datatables.net/extensions/rowreorder/examples/initialisation/events.html

How can I get a reference to the table in order to process this event?

lianee commented 8 years ago

as it turns out, the DataTable is destroyed every updates, so event bindings won't work.

l-lin commented 8 years ago

You can access to the DataTable instance, and thus you can catch the event like this:

dtInstance.DataTable.on('row-reorder', function ( e, diff, edit ) {
    // Do your stuff
});
lianee commented 8 years ago

That's perfect, thanks

niteshvirani commented 8 months ago

@lianee I am using AngularJS 1.5 and I am using angular-datatables but I cannot see plugin for rowReorder. How did you add row reorder?

lianee commented 8 months ago

@lianee I am using AngularJS 1.5 and I am using angular-datatables but I cannot see plugin for rowReorder. How did you add row reorder?

Sorry, I'm afraid I can't help because I don't use angular anymore