How to set rowId property to start by a character

How to set rowId property to start by a character

jstuardojstuardo Posts: 104Questions: 41Answers: 0

Hello,

I need to add id property of TR tag for each record, so that I will be able to operate over the record. However, the record id is a numerical identity. If I add rowId: "id" in datatable definition, a numeric ID is rendered, which is invalid. So, when I call "table.row(this).id()", an undefined is actually got. I think it is undefined since value cannot start with a digit.

How can do it?

Regards
Jaime

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Not sure I understand the question. I put together the test case for you to show integer ID's work and don't result in undefined with this table.row(this).id().

    http://live.datatables.net/hatimufo/1/edit

    You can change rowId to name and see that it still works.

    If you still have problems please update the test case to replicate your issue.

    Kevin

  • jstuardojstuardo Posts: 104Questions: 41Answers: 0

    Thanks... the problem was that I am using a click event on a button... that way, "this" object is not the TR..... so I use "$(this).closest('tr');" to get the reference to TR first, and then call "id()" method.

This discussion has been closed.