Forum Stats

  • 3,874,970 Users
  • 2,266,788 Discussions
  • 7,912,036 Comments

Discussions

how to change IG record from an item and pk with JS

Samuel-Hardy
Samuel-Hardy Member Posts: 9
edited Apr 5, 2017 8:24AM in APEX Discussions

Hi,

    I am on version 5.1.1.

     I have two fields one for the job_number (primaryKey) and another for how long it has setback in hours (changed to mins for the IG).

    Once the values have been validated I want to update the interactive grid column.

   I am currently updating the column using

      var view = apex.region(tableId).widget().interactiveGrid("getViews", "grid"),

      model = view.model;

      var record = model.getRecord(primaryKey);

       var fieldKey = model.getFieldKey(columnID);

      record[fieldKey] = value;

    I have also tried

    model.setValue(record, columnID, value);

  The value is insertedpopuplov.png

But when I save the IG the value is set to null. It does however, say changes saved in the top right.

Any help would be appreciated.

Thanks

Best Answer

  • Samuel-Hardy
    Samuel-Hardy Member Posts: 9
    edited Apr 5, 2017 8:23AM Answer ✓

    After alot of head scratching I realised that the grid had to be focused first when reading How to hack APEX Interactive Grid Part 3.

    How to hack APEX Interactive Grid Part 3 – HardLikeSoftware

    apex.region("jobtable").focus();

    apex.region("jobtable").widget().interactiveGrid("getActions").set("edit", true);

    var model = apex.region("jobtable").widget().interactiveGrid("getViews", "grid").model;

    var record = model.getRecord($v("P2_TABLEREF"));

    model.setValue(record, "ESTIMATE_MINS", $v("P2_TABLEREF"));

    Thank you for writing some very good articles John Snyders.

Answers

  • Samuel-Hardy
    Samuel-Hardy Member Posts: 9
    edited Apr 5, 2017 8:23AM Answer ✓

    After alot of head scratching I realised that the grid had to be focused first when reading How to hack APEX Interactive Grid Part 3.

    How to hack APEX Interactive Grid Part 3 – HardLikeSoftware

    apex.region("jobtable").focus();

    apex.region("jobtable").widget().interactiveGrid("getActions").set("edit", true);

    var model = apex.region("jobtable").widget().interactiveGrid("getViews", "grid").model;

    var record = model.getRecord($v("P2_TABLEREF"));

    model.setValue(record, "ESTIMATE_MINS", $v("P2_TABLEREF"));

    Thank you for writing some very good articles John Snyders.

This discussion has been closed.