Search code examples
oracle-apexoracle-apex-18.2

What causes the interactive grid's "move" notification to fire?


I am using Apex 18.2. The "move" notification in the JSDoc is said to be Sent when one or more records are moved. But I can not find a way to move records. When does it fire and how?


Solution

  • You can move records using the model's moveRecords method: https://docs.oracle.com/en/database/oracle/application-express/18.2/aexjs/model.html#moveRecords

    Here's an example that would move the employees JONES and SCOTT in the EMP table after ALLEN... Before: enter image description here

    This code would move the rows:

    var model = apex.region('emp-reg').widget().interactiveGrid("getCurrentView").model;
    var recordsToMove = [];
    var recordToMoveAfter;
    
    recordsToMove.push(model.getRecord('7566'));
    recordsToMove.push(model.getRecord('7788'));
    
    recordToMoveAfter = model.getRecord('7499');
    
    model.moveRecords(recordsToMove, null, recordToMoveAfter);
    

    After:

    enter image description here