Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Use API deselect method without triggering deselect event

$
0
0

This might be more of a JavaScript or jQuery question, but I came here because you guys are the nicest and most handsome folks on the internet :-)

I'm working on the interaction between multiple tables where only one row can be selected among all the tables.

When I select a row in one table, I use that select event to deselect() the rows in all the other tables:

newly_selected_table.on("select", function ( e, dt, type, indexes ) {
    deselect rows in all the other tables using the API
})

As expected this triggers the deselect event for each of those newly deselected rows, which I use to close the child rows:

previously_selected_table.on("deselect", function ( e, dt, type, indexes ) {
    close child rows
})

However there's a specific circumstance where I want to deselect the other row without triggering the deselect event so that the child rows remain open.

I tried calling an empty function to override the deselect event above, but it didn't work:

newly_selected_table.on("select", function ( e, dt, type, indexes ) {
    if (not special circumstance) {
        previously_selected_table.rows().deselect()
    } else special circumstance {
        previously_selected_table.rows().deselect(function(){
            return false
        })
    }
})

Is something like that possible?


Viewing all articles
Browse latest Browse all 2364

Trending Articles