dhtmlxmenu now doesn't autohide after clicking on checkboxes/radiobuttons, click handler can specifiy whether the field should be checked/unchecked

This commit is contained in:
Andreas Stöckel 2011-04-17 17:42:04 +00:00
parent 5e014cdfe2
commit 7ae2588e84
4 changed files with 37 additions and 6 deletions

View File

@ -222,9 +222,7 @@ egwAction.prototype.execute = function(_senders, _target)
_target == null;
}
this.onExecute.exec(this, _senders, _target);
return false;
return this.onExecute.exec(this, _senders, _target);
}
/**

View File

@ -324,7 +324,7 @@ function egwPopupActionImplementation()
item.set_onClick(function(elem) {
// Copy the "checked" state
elem.data.checked = elem.checked;
elem.data.execute(_selected, _target);
return elem.data.execute(_selected, _target);
});
}
else

View File

@ -23,9 +23,40 @@ function egwMenuImpl(_structure)
if (id)
{
var elem = self.dhtmlxmenu.getUserData(id, 'egw_menu');
if (elem && elem.onClick)
{
elem.onClick(elem);
if (elem.checkbox)
{
self.dhtmlxmenu.setContextMenuHideAllMode(false);
}
var res = elem.onClick(elem);
if (elem.checkbox)
{
var checked = null;
if (res == "checkbox:disable")
{
checked = false;
}
if (res == "checkbox:enable")
{
checked = true;
}
if (checked != null)
{
if (elem.groupIndex != 0)
{
self.dhtmlxmenu.setRadioChecked(id, checked);
}
else
{
self.dhtmlxmenu.setCheckboxState(id, checked);
}
}
}
}
}
});

View File

@ -349,7 +349,9 @@
"checkbox": true,
"checked": false,
"caption": "Test2",
"onExecute": alertClicked
"onExecute": function() {
return "checkbox:disable";
}
}
]
);