Skip to content

Latest commit

 

History

History
80 lines (61 loc) · 3.52 KB

replacing-the-standard-save-functionality-in-the-mass-edit-dialog-492d8a9.md

File metadata and controls

80 lines (61 loc) · 3.52 KB

Replacing the Standard Save Functionality in the Mass Edit Dialog

You can enable custom save functionality for the mass edit dialog.

In the extension function, you can define the logic to save the data provided in the mass edit dialog. The default save functionality is executed by the framework if the extension is not defined. Clean-up tasks, such as closing the dialog, are performed by the framework after the extension logic is executed.

You can implement the beforeMultiEditSaveExtension function within the list report or controller extension.

Sample Code:

beforeMultiEditSaveExtension: function (aContextsToBeUpdated) {
            //aContextsToBeUpdated - The array of objects containing the contexts to be updated and the updated value.
            //aContextsToBeUpdated[].sContextPath - The context path for the child to be updated.
            //aContextsToBeUpdated[].oUpdateData - The Object with the updated values for the selected properties in the multi edit dialog.
            var oApi = this.extensionAPI;
              return new Promise(function(fnResolve,fnReject){
                var oPromise = oApi.invokeActions("STTA_SALES_ORDER_ND_SRV_01/STTA_C_SO_SalesOrder_NDSetopportunityid", [], aContextsToBeUpdated);//Your function import for save here
                oPromise.then(fnResolve,fnReject);
        });

You can implement the customMassEditSave function within the list report or object page controller extension. The default save functionality will not be executed when the customMassEditSave function returns true.

Sample Code:

sap.ui.define(
    [
        "sap/ui/core/mvc/ControllerExtension",
        "sap/m/MessageToast"
    ],
    function (ControllerExtension, Filter, FilterOperator, IllustratedMessage, IllustratedMessageType, MessageToast) {
        "use strict";

        return ControllerExtension.extend("sap.fe.core.fpmExplorer.OPExtend", {
            override: {
                editFlow: {
                    customMassEditSave: async function (aParameters) {
                        // aParameters.aContexts: array containing the selected contexts for the mass edit
                        // aParameters.oUpdateData: a dictionary containing the propertyPath and its updated value
                        
                        //Execute the custom save action
                        await this.base.editFlow
                        .invokeAction("Service.customUpdateAction", {
                            contexts: aParameters.aContexts,
                            parameterValues: aParameters.oUpdateData
                        })
                        .catch(function (e){
                            MessageToast.show(e.toString());
                        });
    
                        //Do not execute the default mass-edit
                        return true;
                    }
                }
            }

        });
    }
);

Related Information

Enabling Editing Using a Dialog (Mass Edit)