mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
Only call the selectCallback once, call it when setAllSelected is called and select the whole row when the checkbox is pre-checked
This commit is contained in:
parent
b424341afe
commit
bc25b8a102
@ -1108,6 +1108,9 @@ egwActionObject.prototype.setAllSelected = function(_selected, _informParent)
|
|||||||
this.selectedChildren.push(this.children[i]);
|
this.selectedChildren.push(this.children[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call the setSelectedCallback
|
||||||
|
egwQueueCallback(this.setSelectedCallback, [], this, "setSelectedCallback");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1138,10 +1141,8 @@ egwActionObject.prototype.updateSelectedChildren = function(_child, _selected)
|
|||||||
this.parent.updateSelectedChildren(this, wasEmpty);
|
this.parent.updateSelectedChildren(this, wasEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.setSelectedCallback)
|
// Call the setSelectedCallback
|
||||||
{
|
egwQueueCallback(this.setSelectedCallback, [], this, "setSelectedCallback");
|
||||||
this.setSelectedCallback.call(this); //TODO: Not called, when non-selected elements are made visible (treeview)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,6 +140,31 @@ function egwArraysEqual(_ar1, _ar2)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _egwQueuedCallbacks = {};
|
||||||
|
function egwQueueCallback(_proc, _args, _context, _id)
|
||||||
|
{
|
||||||
|
if (_proc)
|
||||||
|
{
|
||||||
|
var cur_id = 0;
|
||||||
|
if (typeof _egwQueuedCallbacks[_id] == "undefined")
|
||||||
|
{
|
||||||
|
cur_id = _egwQueuedCallbacks[_id] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cur_id = ++_egwQueuedCallbacks[_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (_egwQueuedCallbacks[_id] == cur_id)
|
||||||
|
{
|
||||||
|
_proc.apply(_context, _args);
|
||||||
|
delete _egwQueuedCallbacks[_id];
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sprintf() for JavaScript 0.6
|
sprintf() for JavaScript 0.6
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ function egwGrid(_parentNode, _columns, _objectManager, _fetchCallback, _columnC
|
|||||||
|
|
||||||
if (self.selectedChangeCallback)
|
if (self.selectedChangeCallback)
|
||||||
{
|
{
|
||||||
self.selectedChangeCallback.call(self.context, allSelected)
|
self.selectedChangeCallback.call(self.context, allSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1688,10 +1688,11 @@ function egwGridViewRow_doUpdateData(_immediate)
|
|||||||
}
|
}
|
||||||
else if (col.type == EGW_COL_TYPE_CHECKBOX)
|
else if (col.type == EGW_COL_TYPE_CHECKBOX)
|
||||||
{
|
{
|
||||||
this.checkbox.attr("checked",
|
var checked = (data[col.id].data === 0) ?
|
||||||
(data[col.id].data === 0) ?
|
|
||||||
egwBitIsSet(this.aoi.getState(), EGW_AO_STATE_SELECTED) :
|
egwBitIsSet(this.aoi.getState(), EGW_AO_STATE_SELECTED) :
|
||||||
data[col.id].data);
|
data[col.id].data;
|
||||||
|
this.checkbox.attr("checked", checked);
|
||||||
|
this.item.actionObject.setSelected(checked);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,10 @@
|
|||||||
|
|
||||||
var columns =
|
var columns =
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"id": "check",
|
||||||
|
"type": EGW_COL_TYPE_CHECKBOX
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "name",
|
"id": "name",
|
||||||
"caption": "Name",
|
"caption": "Name",
|
||||||
@ -210,6 +214,7 @@
|
|||||||
data["ctime"] = (new Date).toUTCString();
|
data["ctime"] = (new Date).toUTCString();
|
||||||
data["owner"] = "as";
|
data["owner"] = "as";
|
||||||
data["group"] = "stylitedevs";
|
data["group"] = "stylitedevs";
|
||||||
|
data["check"] = true;
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
"id": _elems[i],
|
"id": _elems[i],
|
||||||
|
Loading…
Reference in New Issue
Block a user