Use API deselect method without triggering deselect event
Use API deselect method without triggering deselect event
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?
This question has accepted answers - jump to:
Answers
Can you check the "circumstance" in the
deselect
event to determine if the child rows should be closed?Kevin
Thanks, Kevin (@kthorngren) , I can create a separate variable that will do that, but I was just hoping to avoid that if I could override the deselect function somehow.
Yep, the variable would probably be the easiest, unless it's something codable.
And I'm pleased that our grooming regime is being appreciated
Colin
Thanks, @colin and @kthorngren,
Ultimately I just did something like this: