fnGetPosition undefined
fnGetPosition undefined
BigPoppaG
Posts: 4Questions: 1Answers: 0
in DataTables
http://live.datatables.net/vasikox/1/edit
Hi there
Firstly thanks for the amazing tool. All working great even for a novice - except I'm totally stumped here:
Hopefully the datatables live link shows what's going on.
The console log shows the fnGetPosition is undefined.
Can anyone help fix this example.
I'm trying to read the (hidden) id field a datatable based on the clicked cell.
Any help much appreciated.
Thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Second FAQ :-).
Use
$().dataTable()
(lowercased
) if you want to use the old style API methods (I'd recommend you to use the new style API if possible).Allan
Thanks for the really quick reply.
So what is the new style way of looking up the underlying data for the row of a given cell?
Sorry if I'm asking another FAQ.
cell().data()
. The new API is introduced in the manual and has an overview. Would be interested to know what you think of it.Allan
Thanks again Allan. So I can do $(this).data() where this is my clicked td and that gives the data for the whole row? Sorry if I'm still confused. A concrete example would be really helpful. Otherwise I'll give it another go when I'm back coding!
No, you can use the
cell().data()
method. For example:table.row( this ).data()
.If you want it for the whole row, you would use
row().data()
. For a column usecolumn().data().
Keep in mind that each of the selector methods have their own selector types as well. The documentation for each covers them in detail.Allan
Fantastic. That gives me the data given the row. But how do I get the row given the cell? What's the new style version of fnGetPosition? Can I do cell().row()? Last question, honest!
where
this
is a cell.Allan