Skip to main content
tedp80165091
Participant
April 9, 2021
Question

Use a Collective Specifier to get Array of Arrays?

  • April 9, 2021
  • 1 reply
  • 166 views

Suppose I have a table.  I can do this:

var cells = resolve(table.columns.everyItem().cells.everyItem().toSpecifier());

This gives me every cell in the table.

But what if I wanted it as an array of arrays of cells?  That is, an array, where each element is the array of cells in that column.  Is such a thing possible?

This topic has been closed for replies.

1 reply

Peter Kahrel
Community Expert
Community Expert
April 10, 2021

There's no need to use resolve and toSpecifier, it's a (costly) way of doing

var cells = table.columns.everyItem().cells.everyItem();

As to creating an array of arrays the way you're after, I thought that that was possible, but it no longer works. Maybe my memory is faulty, but now it seems that the only way to create an array of arrays fro table rows is to do it 'manually':

cells = [];
rows = table.rows.everyItem().getElements()
for (i = 0; i < rows.length; i++) {
  cells.push (rows[i].cells.everyItem().getElements();
}