dont fire open or preview events if no list item is selected

This commit is contained in:
rlx 2011-01-11 11:16:54 +00:00
parent 6353bcd8ba
commit e10d2fc56a

View File

@ -6713,19 +6713,23 @@ requires
} }
function open() { function open() {
that.triggerEvent('open', { var ids = getSelectedIds();
ids: getSelectedIds() ids.length && that.triggerEvent('open', {
ids: ids
}); });
} }
function preview() { function preview() {
self.preview = !self.preview; var ids = getSelectedIds();
if (self.preview) { if (ids.length) {
that.triggerEvent('openpreview', { self.preview = !self.preview;
ids: getSelectedIds() if (self.preview) {
}); that.triggerEvent('openpreview', {
} else { ids: getSelectedIds()
that.triggerEvent('closepreview'); });
} else {
that.triggerEvent('closepreview');
}
} }
} }
@ -7178,6 +7182,7 @@ requires
id: '', id: '',
max: -1, max: -1,
min: 0, min: 0,
pageLength: 100,
selected: [], selected: [],
request: function() {}, // {sort, range, keys, callback} request: function() {}, // {sort, range, keys, callback}
sort: [] sort: []
@ -7267,6 +7272,7 @@ requires
}), }),
max: self.options.max, max: self.options.max,
min: self.options.min, min: self.options.min,
pageLength: self.options.pageLength,
orientation: 'vertical', orientation: 'vertical',
request: self.options.request, request: self.options.request,
selected: self.options.selected, selected: self.options.selected,
@ -7525,7 +7531,8 @@ requires
var $input, var $input,
html = $cell.html(), html = $cell.html(),
index = getColumnIndexById(key), index = getColumnIndexById(key),
width = self.options.columns[index].width; column = self.options.columns[index],
width = column.width;
Ox.print($item, $cell) Ox.print($item, $cell)
$cell.empty() $cell.empty()
.addClass('OxEdit') .addClass('OxEdit')
@ -7533,6 +7540,7 @@ requires
width: width + 'px' width: width + 'px'
}); });
$input = Ox.Input({ $input = Ox.Input({
autovalidate: column.input.autovalidate,
style: 'square', style: 'square',
value: html, value: html,
width: width width: width
@ -7545,13 +7553,12 @@ requires
}) })
.bindEvent({ .bindEvent({
blur: submit, blur: submit,
submit: submit
}) })
.appendTo($cell) .appendTo($cell)
.focus(); .focus();
function submit() { function submit() {
var value = $input.value(); var value = $input.value();
$input.remove(); //$input.loseFocus().remove();
$cell.removeClass('OxEdit') $cell.removeClass('OxEdit')
.css({ .css({
width: (width - 8) + 'px' width: (width - 8) + 'px'