trigger row selected from double click
trigger row selected from double click
I'm trying to trigger a row to get selected the same way it would get selected with 'select: true' except with double click.
I found a bunch of posts where dblclick event is hooked up to the tr and then trigger toggleClass .. or various other suggestions.. but that doesn't trigger the same behavior as the 'select: true' clicks..
they trigger:
1) they highlight the row by adding 'selected' class.
2) they add a '1 row selected' message at bottom (by pagination stats)
3) they enable the disabled edit and delete buttons.
none of those happen when i toggle selected class or whatever else i have tried to trigger from a dblclick.
suggestions?
This question has an accepted answers - jump to answer
Answers
i just recently started using select and had to override its behavior too, though not for doubleclicking, the principle is the same. this will get you started, you may have to tweak the first listener to allow for row de-selection using .rows().deselect() or something similar
this is dependent on you having a rowID set up for each row, also keep select: true enabled for this
I think you could simplify that a little to be:
No need to get the row id. You can pass the row node in as a selector for
rows()
.The other option would be to modify the Select code to just use
dblclick
rather thanclick
.Allan
thanks so much for the input.. this is what i managed to hack together and it seems to work perfectly.
This lets me :
(tested in chrome/firefox/safari)
only thing missing is shift to select start/end of rows.. but i'm also fine with that 'for now' ..
Select keeps its own internal pointer from its click event for the shift click. So if you wanted to have a shift click you'd need to replicate that logic externally.
Allan