This question is locked. New answers and comments are not allowed.
I've configured my grid to be .Selectable() and .ClientEvents(e => e.OnRowSelect("Grid_OnRowSelect"))
The Grid_OnRowSelect function redirects to a details page of the item that was clicked on. This creates a problem with selecting text in the grid for copying. As soon as the user lets go of the mouse button after highlighting some text the OnRowSelect event fires in IE but not Chrome.
For my purposes I want to prevent clicking if the user is doing highlighting for copying. I came up with the following hack. In Grid_OnRowSelect function put
where getSelected function returns user selected text or false, as described here.
This seems to work ok, but is there a better way?
The Grid_OnRowSelect function redirects to a details page of the item that was clicked on. This creates a problem with selecting text in the grid for copying. As soon as the user lets go of the mouse button after highlighting some text the OnRowSelect event fires in IE but not Chrome.
For my purposes I want to prevent clicking if the user is doing highlighting for copying. I came up with the following hack. In Grid_OnRowSelect function put
//don't click if user highlighted somethingif (getSelected()) return;where getSelected function returns user selected text or false, as described here.
//returns the user selected text on the pagefunction getSelected() { var text = ""; if (window.getSelection && window.getSelection().toString() && $(window.getSelection()).attr('type') != "Caret") { text = window.getSelection(); return text; } else if (document.getSelection && document.getSelection().toString() && $(document.getSelection()).attr('type') != "Caret") { text = document.getSelection(); return text; } else { var selection = document.selection && document.selection.createRange(); if (!(typeof selection === "undefined") && selection.text && selection.text.toString()) { text = selection.text; return text; } } return false;}This seems to work ok, but is there a better way?