Error on multi table with .fnGetData .fnGetPosition
Error on multi table with .fnGetData .fnGetPosition
onserv
Posts: 3Questions: 0Answers: 0
Hi,
Thans for this very nice js framework.
I have this problem :
I have 2 tables on a web page ( http://site.loup-garou.fr/templates/lg/inscription.php ).
I initialize with that :
[code] $('table').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});
oTable = $('table').dataTable();[/code]
but I have an error on the second table If for example I try a simple .fnGetData or .fnGetPosition.
Must I instance the different table seperatly ?
Thanks for your help
Thans for this very nice js framework.
I have this problem :
I have 2 tables on a web page ( http://site.loup-garou.fr/templates/lg/inscription.php ).
I initialize with that :
[code] $('table').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});
oTable = $('table').dataTable();[/code]
but I have an error on the second table If for example I try a simple .fnGetData or .fnGetPosition.
Must I instance the different table seperatly ?
Thanks for your help
This discussion has been closed.
Replies
Allan
So it is possible to have the same Table twice et use .fnGetData ?
[code]
var oTables = $('#example').dataTable();
// Filter table 1
oTables.fnFilter( 'hello' );
// Filter table 2
$.fn.dataTableExt.iApiIndex = 1;
oTables.fnFilter( 'hello' );
// Reset iApiIndex
$.fn.dataTableExt.iApiIndex = 0;
[/code]
In future (v1.10) I might make this a lot easier using an option for the API. It is also possible to wrap this up into an API method such as: http://datatables.net/plug-ins/api#fnFilterAll
Allan
I do something like that but I think it's an agly way....
[code]
try {
var aPos = oTable.fnGetPosition( this );
var sejour = oTable.fnGetData(this.parentNode,0); //on précise 0 pour ne recupérer la valeur que de la 1ere colonne
}
catch(err) {
$.fn.dataTableExt.iApiIndex = 1;
var aPos = oTable.fnGetPosition( this );
var sejour = oTable.fnGetData(this.parentNode,0); //on précise 0 pour ne recupérer la valeur que de la 1ere colonne
}
[/code]
And it's working for 2 tables only. I have to count the number of $('table') and loop ;-/
Any specific method for Counting ?
As I mentioned, take a look at fnFilterAll - that might help you understand what is going on in the background.
Allan