to$() and toJQuery() work with nodes() but not node()

to$() and toJQuery() work with nodes() but not node()

Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10
edited February 2022 in Bug reports

Not sure if this is a bug or not, but . . .

I happen to notice to$() and toJQuery both with with nodes() but not with node().

That seems to be correct according to here: https://datatables.net/reference/api/toJQuery()

However it seems odd that to$() and toJQuery wouldn't work with a single node as well.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,321Questions: 26Answers: 4,948
    edited February 2022 Answer ✓

    APIs like rows().nodes() and cells().nodes() return an API instance along with the results. So you can chain to$() or toJquery().

    The row().node() and cell().node() return just the node without the API instance so chaining won't work. You can put these in a jQuery object ($()) to use jQuery methods.

    Kevin

  • Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10
    edited February 2022

    Thanks, Kevin -- you're right, it hasn't stopped me because I typically use $() on the node(s) anyway.

    It just seems inconsistent from rows().nodes() and additionally the description is essentially the same for both: "Get the row TR node(s) for the selected row(s)."

    Anyway, I wanted to make sure it was intentional design decision and not an oversight!

    Loren

Sign In or Register to comment.