Using toArray(), Is there a way to select all rows and a subset of columns using named columns?

Using toArray(), Is there a way to select all rows and a subset of columns using named columns?

msand01msand01 Posts: 54Questions: 24Answers: 1

I have played around with the syntax but to no avail. For example, I tried this, but I still get all columns:

var myData = table.rows().columns(['ID:name', 'Status:name']).data().toArray();

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin
    Answer ✓

    rows() selects rows, columns() selects columns - they do not take an intersection of the two! For that use cells() which will do what you want (although it will get the data in a flat array - is that want you want? If not, then you need to use a loop on the rows() method (i.e. loop over each row, getting the data you want for it)).

    Allan

This discussion has been closed.