This discussion is archived
5 Replies Latest reply: Dec 6, 2012 12:11 PM by JackieW RSS

Updating Tabular Form updates both checked and unchecked rows.

JackieW Newbie
Currently Being Moderated
In APEX 4.1 I created a tabular form using the wizard. I chose UPDATE and DELETE. I did not want to insert. I selected primary key rather than row number in the wizard.

If I change a row on the screen and hit SUBMIT, it will update the table whether the row is checked or not. Is this how it is supposed to work? When deleting, only the checked rows are deleted.

By the way, I am happy that it is behaving this way, as this behavior matches my requirement. But it disturbs me because I did not deliberately configure this behavior.

Edited by: JackieW on Dec 6, 2012 9:50 AM

Edited by: JackieW on Dec 6, 2012 9:52 AM
  • 1. Re: Updating Tabular Form updates both checked and unchecked rows.
    Denes Kubicek Oracle ACE Director
    Currently Being Moderated
    The checkbox in the tabular form is for selecting the rows to delete. This is the only purpose of that checkbox column.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------
  • 2. Re: Updating Tabular Form updates both checked and unchecked rows.
    Arie Geller Guru
    Currently Being Moderated
    Hello Jackie,

    >> If I change a row on the screen and hit SUBMIT, it will update the table whether the row is checked or not. Is this how it is supposed to work?

    Yes.

    If you look at the processes of your page, you’ll see that the update action and the delete action have separate processes - ApplyMRU and ApplyMRD. Each process is conditioned by its corresponding button. It means that if you click on the Submit button, the ApplyMRD process is not invoked, hence, checking the row has no affect.

    Regards,
    Arie.

    -------------------------------------------------------
    ♦ Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

    ♦ Author of Oracle Application Express 3.2 – The Essentials and More
  • 3. Re: Updating Tabular Form updates both checked and unchecked rows.
    JackieW Newbie
    Currently Being Moderated
    Thank you both. Just to make it even more clear to my users, I will go into the template and put the word "Delete" at the top of the column.
  • 4. Re: Updating Tabular Form updates both checked and unchecked rows.
    Marc Sewtz Pro
    Currently Being Moderated
    I just like to add that by default, the row selector is indeed only used for selecting rows that are to be deleted. However the row selector can also be referenced programmatically in PL/SQL page processes to perform certain other operations on the tabular form data. And with the enhancements introduced in APEX 4.1. there is now a variable called "APEX$ROW_SELECTOR" that can be used in a tabular form PL/SQL page process. The value of that APEX$ROW_SELECTOR is 'X' for rows that are selected.

    As an example, let's say you have a tabular form on the EMP table, and you wanted to have a way to select a number of employees and given them a 10% raise, you could use the row selector, along with a 'RAISE' button and a tabular form page process that fires when the RAISE button was clicked. The process would look like this:

    if :APEX$ROW_SELECTOR='X' then
    update emp set sal = sal * 1.1 where empno = :EMPNO;
    end if;

    Unlike in past releases, where you would write long PL/SQL processes, that loop through apex_applicaiton arrays, and were you would have had to take into account that checkboxes only return values when they were actually checked, this is now really easy: no more need to deal with the apex_application.g_fxx arrays, no need for looping through all rows. All of this is done by the engine, the above code is executed for each row automatically (or each modified row - based on your settings) and all values in the row that is currently being processed are available via bind variables.

    Regards,
    Marc
  • 5. Re: Updating Tabular Form updates both checked and unchecked rows.
    JackieW Newbie
    Currently Being Moderated
    Just in case anyone is interested, here is how I put "Delete" at the top of the row selector column. I also had a requirement to remove the select all checkbox on the top left. This is the relevant section of the original view source:
    <tr >
    <th abbr="Select Row" class="header" align="left"  id="CHECK$01">
    <label for="check-all-rows" class="hideMeButHearMe">Check All</label>
    <input type="checkbox" id="check-all-rows" name="x02" value="1" onclick="checkAll(this)" /></th>
    I put this in the Function and Global Variable Declaration section of my page header:
    $('#check-all-rows').hide();
    $("label[for='check-all-rows']").removeClass("hideMeButHearMe");
    $("label[for='check-all-rows']").text("Delete?");
    I'm happy to say that I know just enough jquery to be dangerous. :)

    Edited by: JackieW on Dec 6, 2012 12:08 PM

    Edited by: JackieW on Dec 6, 2012 12:11 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points