Skip to content
Browse files

Added an "enableTextSelectionOnCells" option and fixed text selection…

… getting hijacked by drag'n'drop in dragInit.
  • Loading branch information...
1 parent df064ff commit ed9e5a8e35065c66ce22400228306f5ca5f13750 @mleibman mleibman committed Mar 22, 2011
Showing with 16 additions and 3 deletions.
  1. +16 −3 slick.grid.js
View
19 slick.grid.js
@@ -81,7 +81,8 @@ if (typeof Slick === "undefined") {
editorFactory: null,
cellFlashingCssClass: "flashing",
selectedCellCssClass: "selected",
- multiSelect: true
+ multiSelect: true,
+ enableTextSelectionOnCells: false
};
var columnDefaults = {
@@ -235,7 +236,14 @@ if (typeof Slick === "undefined") {
// selection in grid cells (grid body) is already unavailable in
// all browsers except IE
disableSelection($headers); // disable all text selection in header (including input and textarea)
- $viewport.bind("selectstart.ui", function (event) { return $(event.target).is("input,textarea"); }); // disable text selection in grid cells except in input and textarea elements (this is IE-specific, because selectstart event will only fire in IE)
+
+ if (!options.enableTextSelectionOnCells) {
+ // disable text selection in grid cells except in input and textarea elements
+ // (this is IE-specific, because selectstart event will only fire in IE)
+ $viewport.bind("selectstart.ui", function (event) {
+ return $(event.target).is("input,textarea");
+ });
+ }
viewportW = parseFloat($.css($container[0], "width", true));
@@ -338,7 +346,10 @@ if (typeof Slick === "undefined") {
/// the specified target.
/// </summary
if ($target && $target.jquery) {
- $target.attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart.ui', function() { return false; }); // from jquery:ui.core.js 1.7.2
+ $target
+ .attr('unselectable', 'on')
+ .css('MozUserSelect', 'none')
+ .bind('selectstart.ui', function() { return false; }); // from jquery:ui.core.js 1.7.2
}
}
@@ -1541,6 +1552,8 @@ if (typeof Slick === "undefined") {
if (e.isImmediatePropagationStopped()) {
return retval;
}
+
+ return false;
}
function handleDragStart(e,dd) {

0 comments on commit ed9e5a8

Please sign in to comment.
Something went wrong with that request. Please try again.