Get row
Get row

How to access any row from a list of rows returned by dt.rows(".is-something")? Why does not dt.rows(".is-something")[0] work?
This discussion has been closed.
How to access any row from a list of rows returned by dt.rows(".is-something")? Why does not dt.rows(".is-something")[0] work?
Replies
The
rows()
returns a Datatables API instance not the specific data. To get the data you would userows().data()
. Therows().data()
example shown shows how to get the first row returned. So you could use something like this:dt.rows(".is-something").data()[0]
Kevin
That's fine but what if we need to access to the html node(tr) for the row?
Then use the
.
row().node()
methodThe API reference is available here.
Allan
So, it is not simply possible after getting rows with dt.rows(".is-something") and select the first or nth. row and get its node()?
Maybe I'm missing something in your question but you could do something like this:
The
rows()
documentation states that it returns an API instance. Then you can usenodes()
ordata()
or other API methods to get the desired data.Kevin
So, following is my solution.