Created
September 13, 2013 11:24
-
-
Save derjabkin/6549465 to your computer and use it in GitHub Desktop.
XAF ASP.NET Shortcut for an action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ActionContainerHolderEx : ActionContainerHolder | |
{ | |
protected override DevExpress.ExpressApp.Web.Templates.ActionContainers.Menu.MenuActionItemBase CreateSimpleActionItem(DevExpress.ExpressApp.Actions.SimpleAction simpleAction) | |
{ | |
SimpleActionMenuActionItem item = base.CreateSimpleActionItem(simpleAction) as SimpleActionMenuActionItem; | |
if (item != null) | |
{ | |
ModificationsController controller = item.Action.Controller as ModificationsController; | |
if (controller != null) | |
{ | |
IModelDetailViewSaveAndCloseOnEnter model = | |
controller.View.Model as IModelDetailViewSaveAndCloseOnEnter; | |
if (model != null && model.SaveAndCloseOnEnter) | |
{ | |
if (item.Action.Id == "SaveAndClose") | |
{ | |
Menu.ClientSideEvents.Init = | |
@"function(s,e) { | |
document.onkeyup = function(e) { | |
var keyCode = (window.event) ? event.keyCode : e.keyCode; | |
if (keyCode == 13) {" + | |
item.GetScript(((ICallbackManagerHolder) Page).CallbackManager, UniqueID, "1") + | |
//HACK: IndexPath = "1" for the Save&Close command. | |
";} } }"; | |
} | |
} | |
} | |
} | |
return item; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment