How can I get all of the record IDs from a model into a Javascript variable?

Danny HartleyDanny Hartley ✭✭✭
edited December 27, 2017 in Questions
var payableModel = skuid.model.getModel('Accounts_Payable');
    var modelRows = payableModel.getRows();
    var selectedItems = modelRows.getField("id");

I would like "selectedItems" to contain all of the record IDs from the "Accounts_Payable" model.  Thanks in advance for any help!


  • edited December 23, 2017
    Hi Danny, You can use: Object.keys(payableModel.dataMap); Thanks. Gyan
  • Danny HartleyDanny Hartley ✭✭✭
    edited December 24, 2017
    Thanks, Gyan.  That did the trick.
  • edited December 27, 2017
    Since dataMap is an internal cache, I would recommend using the following, which uses supported API methods:
    var allRowIds = payableModel.getRows().map(function(row) {
       return payableModel.getRowId(row);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!