Your code is very well written. I would suggest using the native method .click() from jQuery to register a single click event, rather than using on(). So, please update the following line:
tmContainer.find("table.cv-invitees").on('click', 'tr', function (e) {
To:
tmContainer.find("table.cv-invitees").click(function (e) {
This change should resolve any issues you may be experiencing. For some reason, the function:
$("#someelement").on("click", ...);
does not always work reliably. It is recommended by jQuery to use native functions for standard events like onclick, onkeyup, onchange, etc., due to this inconsistent behavior.
Edit:
If double-click does not work after making these adjustments, split it into two separate lines like this:
tmContainer.find("table.cv-invitees").click(function (e) {
// [...]
;
tmContainer.find("table.cv-invitees").dbclick(function (e) {
// [...]
Edit2:
If the issue persists, try removing the single click event listener when inside the .click() closure. This ensures that dbclick() will not be triggered as .click() always takes precedence. By doing this, you prevent jQuery from counting two fast clicks as a double click.
Edit3: Here is the complete code with the suggested changes:
$(function () {
// Code block remains intact for brevity
});
In your case, interpreting a double click as three consecutive clicks at the same table entry may cause confusion. Adjusting the timing between clicks to detect a double click accurately can help address this special scenario.
Edit 4: Consider testing whether clicking on three different table columns triggers a double click. Handling multiple clicks on various table elements efficiently requires tracking the number of clicks per column. Several approaches, such as using data attributes or global objects, can facilitate this process.