TypeScript Datei

module BA.Training {
    "use strict";
    export class Actions {
        public static ClientActionAddService(event: any, customData: CustomData) {
            let igniterParams: CustomData = {};
            igniterParams['RemarkMessage'] = customData.RemarkMessage;
            customData["MassOperationIgniterParameters"] = JSON.stringify(igniterParams);
            BA.Ui.Actions.GridActions.StartMassOperation(event, customData);
        }
    }

    window.setTimeout(
        function () {
            BA.Ui.Actions.ActionHandler.RegisterAction("BA.Training.ClientActionAddService", Actions.ClientActionAddService);
        },
        10
    );
}

Bundle Integration

namespace BA.Training.App_Start
{
    public class BundleConfig : IBundleConfig
    {
        public void RegisterBundles(BundleCollection bundles)
        {
            string assemblyName = GetType().Assembly.GetName().Name;

            // Script Bundle ermitteln und falls es noch nicht existiert erstellen
            Bundle bundle = bundles.FirstOrDefault(ff => ff.Path == "~/bundles/scripts");
            if (bundle == null)
            {
                bundle = new ScriptBundle("~/bundles/scripts");
                bundles.Add(bundle);
            }

            // Eigene JavaScript Dateien einbinden (Auf Groß- und Kleinschreibung achten)
            bundle.Include(
                $"~/scripts/BA.Training/Actions.js?{ assemblyName }"
            );
        }
    }
}

Igniter

namespace BA.Training.Igniters
{
    public class AddServiceIgniter : OperationOverSelectedRecordsIgniterBase
    {
        public AddServiceIgniter(IgnitionModel ignitionModel) : base(ignitionModel)
        {
            AllRecordsIfNothingIsSelectedIndicator = false;
            CreateTemporaryRecordsIndicator = false;
            UniqueRecordListIndicator = true;
        }

        public override ActionResult Ignite()
        {
            if (SomethingSelected && IgnitionModel.Parameters.TryGetValue("RemarkMessage", out object remarkObj) && remarkObj is string remark && !string.IsNullOrWhiteSpace(remark))
            {
                Session session = Api.ORM.GetNewSession();
                IEnumerable<Guid> oids = Records.Select(ff => ff.Oid);
                IQueryable<OrmEngine> engines = Api.ORM.GetQuery<OrmEngine>(session).Where(ff => oids.Contains(ff.Oid));
                DateTime date = DateTime.Now;
                foreach (OrmEngine engine in engines)
                {
                    OrmSubEngineServices service = engine.Services.AddNewObject();
                    service.SortOrder = engine.Services.Count() - 1;
                    service.ServiceDate = date;
                    service.Remark = remark;
                    engine.Save();
                }

                return new JsonResult() { Data = new JsonFormResult() { RefreshGrid = true } };
            }

            return null;
        }
    }
}

Ribbon bar Aktion

namespace BA.Training.Configuration.Navigation
{
    [Serializable]
    [Toolbox(EnumConfigurationType.NavigationConfigurationGuid, true)]
    [ControlFilter("NavigationConfigurationType", ExpressionType.Equal, EnumNavigationConfigurationType.RibbonNavigationGuid, EnumControlFilterApplyState.IfPositive)]
    public class ClientActionAddService : ClientActionGridMassOperationBase
    {
        [DisplayName("41ABA083-E37A-4709-98D4-1D685496459C")]
        public string RemarkMessage { get; set; }

        public ClientActionAddService() : base()
        {
            ToolboxName = "DEBED3B0-36A7-4948-B647-116D76A64504";
            Caption = "DEBED3B0-36A7-4948-B647-116D76A64504";
            ControlInitName = "TrainingActionAddService";
            ToolboxGroupName = "C007681C-8644-4BB0-A4A0-4A643265EABD";
            Id = "97C171CA-F872-4245-8AC5-43BF169155E7".ToGuid();
            Icon = "wrench";
            IconName = Icon;

            VisibilityForParentTypes.Add(EnumActionVisibleForParentType.Grid);

            MassOperationIgniter = typeof(AddServiceIgniter).AssemblyQualifiedName;

            DynamicClientVisibility.Add(EnumActionVisibility.SomethingSelected);
            SomethingMustBeSelected = true;

            ActionMethodId = "BA.Training.ClientActionAddService";
        }

        public override void AdditionalRibbonButtonAssignment(DevExpress.Web.RibbonButtonItem ribbonItem, EnumActionVisibleForParentType parentType, DevExUIModelBase uiModel = null)
        {
            base.AdditionalRibbonButtonAssignment(ribbonItem, parentType, uiModel);
            AdditionalClientData.AddOrUpdate("RemarkMessage", RemarkMessage);
        }
    }
}