Select extension - problem with window.getSelection
Select extension - problem with window.getSelection
Areko
Posts: 3Questions: 1Answers: 0
Hi,
in function enableMouseSelection(dt) event click.dtSelect is canceled if there is any selection in window.
It is problem if I want to select row and immedietly open dialog with preselected text in input.
I found solution - changing source code:
if ( window.getSelection && $.trim( window.getSelection().toString() ) ) {
return;
}
to
if (window.getSelection && $.trim(window.getSelection().toString())
&& window.getSelection().baseNode.parentNode.closest('table')) {
return;
}
Have you better idea how to do it more elegant and restrict condition to current table only (not any table)?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The code should only really be getting executed when activated by the selector used in the table.
Could you give me a link to a test case showing the issue with step by step instructions how to recreate the problem please?
Allan
After making fiddle I see problem exist in Chrome only:
https://jsfiddle.net/1zp1r5rz/5/
To recreate problem try to select by clicking on "Age" column.
Oh I see - thanks for the JSfiddle. I would never have thought of that!
I'll have this fixed for the next version of Select. Until then, as a quick workaround you could use a little
setTimeout()
to make the text selection async. Or the change that you have made into the Select code loos sensible. I think the only change I would make is to compare the table to thetable().node()
element rather than just checking for a table element.Regards,
Allan
Thanks for quick answer.
I'll make workaround and wait for next version.