How can I get a simple array of the table's data that has .find()?

How can I get a simple array of the table's data that has .find()?

BuffgeekBuffgeek Posts: 2Questions: 1Answers: 0

It seems that whatever object is produced by table.data(), it isn't an array that has a .find method. I had trouble navigating it in the console - even though it had the data referenceable by index [0] [1]... etc. it wasn't a standard javascript array because I couldn't use the .find function on it. This seems like it should be an important feature, to be able to simply export the table's data into a 1d array of objects so that I can use javascript's array methods against it.

In my specific case I'm feeding a pie chart with data from the table so that I don't have to ask my API for the data twice. And I'm using the .find() method when the user hovers over a pie slice to get the data row associated with that pie slice.

Answers

  • BuffgeekBuffgeek Posts: 2Questions: 1Answers: 0

    Oops I already solved this using toArray(). Now how do I delete my own question? :expressionless:

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    I'd say that might be useful for others who might search for the same problem! :)

    C

This discussion has been closed.