How could I get the particular column data in a rows('.select') object?

How could I get the particular column data in a rows('.select') object?

gonghaigonghai Posts: 3Questions: 1Answers: 0
edited February 2022 in DataTables

Link to test case: https://datatables.net/examples/api/select_row.html
Debugger code (debug.datatables.net): none
Error messages shown: none
Description of problem: On the official page: https://datatables.net/examples/api/select_row.html

It says I can use .rows() to get the context object.

So I picked these following rows:

However, If I want to get all the names in an array, in this particular case, like:

["Angelica Ramos", "Brielle Williamson", "Bruno Nash"]

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    You can use pluck() to get that name field - see the examples at the end of that reference page,

    Colin

  • gonghaigonghai Posts: 3Questions: 1Answers: 0

    colin, thanks a lot. you are my hero!:)

  • gonghaigonghai Posts: 3Questions: 1Answers: 0

    oh, sorry , just one thing.

    After calling pluck(), how can I retrieve the data as an array?

    It seems the pluck() still returns a DT object.

  • kthorngrenkthorngren Posts: 21,262Questions: 26Answers: 4,934
    edited February 2022

    Try toArray(). Checkout the Datatables Utility section of the API docs for more fun APIs :smile:

    Kevin

Sign In or Register to comment.