Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamically Show/Hide button in Interactive Grid

user8817295Sep 21 2018 — edited Dec 12 2018

Hi All,

I have a requirement to Dynamically add/remove "Select-All" button in the interactive Grid based on page item value. Below works and shows custom button "Select-All"

function(config) {

    var $ = apex.jQuery,

        toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),

        toolbarGroup = toolbarData[toolbarData.length - 1]; // this is the last group with reset button

    // add our own button

    toolbarGroup.controls.push(

       {

        type: "BUTTON",

        action: "Select-All",

        hot:true

      }

    );

    config.toolbarData = toolbarData;

    config.initActions = function( actions ) {

        actions.add( {

            name: "Select-All",

            label: "Select All",

            action: function(event, focusElement)

            {

               view=apex.region("IGId").widget().interactiveGrid("getCurrentView");

               model=view.model;

               model.forEach(function(r)

               {

                  var record = r;

                  model.setValue(record,"SELECTED",'Y');

               })

            }

        } );

    }

    return config;

When I add if condition in the actions function like

if ($v("P100_SELECT_FLAG") ="N")

{ actions.hide("Select-All");}

else { actions.show("Select-All");}

interactive grid does not render (interactive grid does not show).

If enter show or hide without if clause it works.

Please help me whats wrong here..

Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 9 2019
Added on Sep 21 2018
2 comments
2,720 views