fix a bug in text lists where selecting an item by clicking on an editable cell would click through to edit
This commit is contained in:
parent
b881f74c7e
commit
fdecafe4d7
1 changed files with 18 additions and 20 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue