DataTables 1.10.0 fnOpen & oTable.columns() Contradictory behaviour
DataTables 1.10.0 fnOpen & oTable.columns() Contradictory behaviour
paragpatil
Posts: 10Questions: 3Answers: 0
Hi,
I am using Datatables 1.10.0 Version. When I use $('#tableName').dataTable() for table initialization, fnOpen works perfectly filne for Child row detail but columns() do not work. And if I use $('#tableName').DataTable() for table initialization, columns work fine but fnOpen stopped working with undefined error.
I have tried to use 1.10.1 version but seems it didn't helped me.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
See the second top FAQ.
Allan
Hi Allan, I agree that this question is posted as free community support. But shouldn't this issue has been resolved?
I don't really understand your second question. I don't think there is any error in DataTables here.
Your question in the first post in this thread is answered by the FAQ I linked to. You need to use
$().DataTable()
if you want to use the new API, and$().dataTable()
if you want to use the old API.If you think there is an error, please link to a test case showing the issue.
Allan
I am using below code to show row detail,
this.src = "../../Content/Images/details_close.png";
aID = $(this).attr("rel");
url = $("#tblCollection").data('url')
(url + "?aID=" + aID, function (lstIteration) {
.fnOpen(nTr, lstIteration, 'details');
It work perfectly fine if I use oTable = $('#tblCollection').dataTable() but as soon as I make it oTable = $('#tblCollection').DataTable(). I start getting error at ".fnOpen(nTr, lstIteration, 'details');" stating function is undefined.
In contrast, I use oTable.columns().eq(0).each(function (colIdx) { for row specific searching, It work fine for oTable = $('#tblCollection').DataTable() but when I change to oTable = $('#tblCollection').dataTable() it start giving undefined function error at ".columns()".
Due to this problem, I can not use both Individual Column Search and Row Detail Information on single table.
Yes. As I said and as the FAQ says, the
$().DataTable()
constructor gives you the new API. That is not a bug. That is a documented feature.You are mixing both the old API and the new API. Is there a reason for that? Why not just write the code using the new API only? Or if you need the old API, use the old API.
You can mix the two (I wouldn't suggest you do though), but you need to use both forms of the constructor.
Allan
Understood Allan,
I want to use new API. But I am not able to use fnOpen() with new API.
Is there any function introduced in new API for fnOpen(), if so then I am not yet aware with it. If not then how can I use both fnOpen() & oTable.columns() with new API. Any example would be greatly appreciated.
http://datatables.net/upgrade/1.10-convert
Yes - the
row().child()
methods.You might find this guide useful: http://datatables.net/upgrade/1.10-convert
Also, as I say you can mix the two:
Allan
Thanks Allan and Tangerine. This is exactly I was looking for.