diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 3efd6658..d4824a3a 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -765,7 +765,7 @@ Ox.List = function(options, self) { function mousedown(data) { var pos = findItemPosition(data); - self.hadFocus = that.hasFocus(); + //self.hadFocus = that.hasFocus(); that.gainFocus(); if (pos > -1) { if (data.metaKey) { @@ -784,6 +784,16 @@ Ox.List = function(options, self) { } else if (!isSelected(pos)) { // click on unselected item select(pos); + } else if (self.options.type == 'text') { + $cell = findCell(data); + if ($cell) { + clickable = $cell.is('.OxClickable'); + editable = $cell.is('.OxEditable') && !$cell.is('.OxEdit'); + if (clickable || editable) { + // click on a clickable or editable cell + triggerClickEvent(clickable ? 'click' : 'edit', self.$items[pos], $cell); + } + } } } else if (!$(data.target).is('.OxToggle') && self.options.min == 0) { // click on empty area @@ -840,29 +850,17 @@ Ox.List = function(options, self) { } function singleclick(data) { - // these can't trigger on mousedown, + // this can't trigger on mousedown, // since it could be a doubleclick var pos = findItemPosition(data), clickable, editable; - //alert('singleclick') if (pos > -1) { - if (!data.metaKey && !data.shiftKey && isSelected(pos)) { - //alert('??') - if (self.selected.length > 1) { - // click on one of multiple selected items - //alert('!!') - select(pos); - } else if (self.options.type == 'text' && self.hadFocus) { - $cell = findCell(data); - if ($cell) { - clickable = $cell.is('.OxClickable'); - editable = $cell.is('.OxEditable') && !$cell.is('.OxEdit'); - if (clickable || editable) { - // click on a clickable or editable cell - triggerClickEvent(clickable ? 'click' : 'edit', self.$items[pos], $cell); - } - } - } + if ( + !data.metaKey && !data.shiftKey + && isSelected(pos) && self.selected.length > 1 + ) { + // click on one of multiple selected items + select(pos); } } }