Search code examples
oracle-apex

Customizing the Record Level Actions of Interactive Grid with Oracle Apex


In the Interactive Grid I have List of records having 'ID', 'Name', 'FK_ID' columns. I want to add an action into the record level actions which appears next into IG rows, so I can redirect into other page and passing the ID and FK_ID parameters of that record into the page. How I customize the actions of the record action menu not the main IG Action Menu as what mostly explained?


Solution

  • This video explains what I want How To Add Row Level Actions. Simply, add two global variables into the page ig_grid for Interactive Grid region view and ig_model for the Interactive Grid model. then, add Page Change [Interactive Grid] Dynamic Action into the grid region that includes this Execute Javascript Code Action and set its code to this:

    ig_grid = apex.region('ig_static_id').call("getViews", "grid");
    ig_model = ig_grid.model;
    
    ig_grid.rowActionMenu$.menu("option").items.push({
        type: "action",
        label: "Show Details",
        id: "show-details",
        action: function (event, focusElement) {
            const savingPromise = apex.model.save(null, null, students_model.modelId()) ?? Promise.resolve(null);
            savingPromise.then(
                function redirectToPage() {
                    let record = ig_grid.getContextRecord(focusElement)[0]
                    var record_id = record[9] // the column order is 9 in IG model
                    var record_fk_id = record[2] // the column order is 2 in IG model
    
                    var parameters_names = "P100_ID,P100_FK_ID"
                    var parameters_values = record_id + "," + record_fk_id
                    var url = "f?p=" + apex.env.APP_ID + ":" + 100+ ":" + apex.env.APP_SESSION + "::::" + parameters_names + ":" + parameters_values;
                    apex.navigation.redirect(url);
                });
    
        }
    })