• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Use a Collective Specifier to get Array of Arrays?

Community Beginner ,
Apr 09, 2021 Apr 09, 2021

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

115

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2021 Apr 10, 2021

Copy link to clipboard

Copied

LATEST

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();
}

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines