APEX IG Cookbook Update

Here is an update (revision 2) of the Interactive Grid Cookbook. You can download it here. This revision adds an example of reordering rows. This has been asked for on the APEX discussion forums. The example is a task list editing page.

The example also shows a workaround for the “no data found” error that can happen when saving data if the SQL statement has a where clause. When the IG SQL statement has its own where clause, such as “... where EXAMPLE_COL = :P1_CURRENT“, if the column is editable and the user changes the value so it no longer matches the where expression you get the error. The reason is that as part of saving the data the IG Automatic Row Processing (DML) process tries to get the latest values for edited records and if a record is now out side of the result set because of the where clause you get the error. A number of people have run into this problem.

Feel free to discus the techniques shown in this app or issue with this app on the APEX Discussion Forum. This is not an officially supported sample but I’ll reply if possible and you can all help each other as well.

8 thoughts on “APEX IG Cookbook Update

  1. Hi Joost,
    To update a cell when another cell in the same row is edited there is no need to use the model. A simple dynamic action will do. No different than doing it in a form page. If still have question ask on OTN APEX forum.
    Regards,
    -John

  2. Hi John,

    I’m trying to extend the example dynamic column total to set a calculated column
    So what I did is created an extra column total salary this is the salary + commision

    I created an extra function update_total This function I cal in the following block:

    if (change.field === “SAL” ) {
    update( model );
    update_total(model,change.recordId);
    }

    function update_total(model,row_id) {
    var record = model.getRecord(row_id);
    var sal = model.getValue(record,”SAL”);
    var commision = model.getValue(record,”COMM”);
    var total_sal = parseInt(sal) + parseInt(commision);
    model.setValue(record,”TOTAL_SALARY”,total_sal);
    console.log(“total_salary:” + total_sal);
    }

    The function works well because in the console log I see the total salary. In the grid I also see that the value is changed. I see a blue marker in the cell.
    I only don’t see the new value in the cell total_salary it doesn’t change. What do I wrong ?

    Regards,
    Joost

  3. @Giovanni the sample interactive grid app is available as a packaged application that comes with all installs of APEX. From the builder click on Packaged Apps menu at the very top of the page. Click Sample to make it easier to find. Then click to install it.

  4. Good morning John,

    Is there a way to find the sql_query of an IG using the Oracle Apex Dictionary views like the APEX_APPLICATION_PAGE_IR.SQL_QUERY

    Thank you

  5. Hi John.
    Thank for the new sample app. There are a number of things I can definitely use.
    A couple of my customers have also run into the “no data found” issue, so its great to have a solution for that.

    Concerning the new row re-ordering sample, it would be fantastic to re-order using drag/drop (a customer have requested this).
    Do you think it will be possible ?

    Brgds
    Martin

Comments are closed.