Interactive Grid "Add Row" generate In the last section


In the last section, you want to generate a row in the Grid region.
So you can follow the steps.

Go to 
Function and Global Variable Declaration :

function f_add_row_last() {
    var row$;
    var region = apex.region('tots');
    var view = region.call("getCurrentView");

    if (view.internalIdentifier === "grid") {
        row$ = region.widget().find(".a-GV-row").last();
        view.view$.grid("setSelection", row$);
        region.call("getActions").invoke("selection-add-row");
    }
}

Select  Grid region then Static ID: tots

Go to Grid region attributes then
Go to  Initialization JavaScript Function and paste the following code:

function(config) {
    let $ = apex.jQuery,
        toolbarData = $.apex.interactiveGrid.copyDefaultToolbar();
    // toolbarGroup = toolbarData.toolbarRemove("actions2");
    toolbarGroup = toolbarData.toolbarRemove("actions3");
    toolbarData.push(
        {
            groupTogether: false,
            align: "start",
            controls: [
                {
                    type: "BUTTON",
                    action: "addrow",
                    id: "saveid",
                    label: "Add Row",
                    hot: true
                }
            ]
        }
    );

    config.initActions = function (actions) {
        actions.add({
            name: "addrow",
            action: function () {
               f_add_row_last();
            },
        });

    }
    config.toolbarData = toolbarData;
    return config;
}




 

Post a Comment

Previous Post Next Post