3 Replies Latest reply on Mar 21, 2017 9:36 AM by m_yasirali

    Row Selector

    Muhammad Rafi



      In one of the editable interactive grid based on the selected rows I need to perform DML operations.


      When i used the syntax as



      if :APEX$ROW_SELECTOR = 'X' then



      END IF;



      There is no effect on the above code, please suggest



        • 2. Re: Row Selector
          John Snyders-Oracle

          This feature (sending selected records to the server) is not yet implemented


          Processing selected rows ( not changed / inserted /deleted) in interactive Grid.



          • 3. Re: Row Selector

            FOR PL/SQL Based Approach with submit:

            Settings for your Region:

            Source > SQL Query

            select empno, ename, deptno 

              from emp 

            Attributes > Edit > Enabled = Yes


            Settings for your Save Interactive Grid Data process:

            Settings > Set Target Type = PL/SQL Code

            Settings > PL/SQL Code to Insert/Update/Delete



                 case :APEX$ROW_STATUS 

                 when 'I' then -- Note: In EA2 this has been changed from I to C for consistency with Tabular Forms 

                     insert into emp ( empno, ename, deptno ) 

                     values ( :EMPNO, :ENAME, :DEPTNO ) 

                     returning rowid into :ROWID; 

                 when 'U' then 

                     update emp 

                        set ename  = :ENAME, 

                            deptno = :DEPTNO 

                      where rowid  = :ROWID; 

                 when 'D' then 

                     delete emp 

                     where rowid = :ROWID; 

                 end case; 


            If your INSERT statement or your PL/SQL API call generates a primary key as it's the case with the ROWID, you have to assign the result to the primary key column again. In the above case I'm using a RETURNING clause to do so. This is important, because that primary key value is used to query the newly inserted data. Only in the case if the end user enters a primary key value then this is not necessary.



            FOR Javascript & PL/SQL based Approach without submit


            1st get Selected Rows & Store them in a Page Item

            2nd Process Rows on Submit


            var gridView = apex.region("mystaticid").widget().interactiveGrid("getViews").grid;

            var records = gridView.getSelectedRecords();

            var ids = records.map(function(r) { return gridView.model.getRecordId(r); } );

            console.log("keys: " + JSON.stringify(ids)

            $s("P1_SELECTED_IDS", ids.join(":"));


            the grid widget has option persistSelection even though IG doesn't yet support Submit Includes Selected Rows. So you can set it with Advanced JavaScript Code:

            function(config) {

                config.defaultGridViewOptions = {

                    persistSelection: true


                return config;



            if pagination type is Page. The selection is remembered as you navigate next/previous.

            And you can now get the selection from the model. The code looks very similar. Can you spot the difference


            var gridView = apex.region("mystaticid").widget().interactiveGrid("getViews").grid;

            var records = gridView.model.getSelectedRecords();

            var ids = records.map(function(r) { return gridView.model.getRecordId(r); } );

            console.log("ids: ", ids.join(":"));

            $s("P1_SELECTED_IDS", ids.join(":"));


            Because the grid/model isn't being submitted, I cannot use the APEX$ROW_STATUS to manually delete records either


            In the submit process/Dynamic Action you need:



                 l_arr      APEX_APPLICATION_GLOBAL.VC_ARR2;


                 l_arr := APEX_UTIL.STRING_TO_TABLE('P1_SELECTED_IDS', ':');


            for i in 1 .. l_arr.count


                 delete from MyTable where ROWID = l_arr(i);

              end loop;