Problem upgrading from 1.9.4 to 1.10.5
Problem upgrading from 1.9.4 to 1.10.5
micheld88
Posts: 12Questions: 3Answers: 0
Hello.
My code was working fine with version 1.9.4. So I've upgraded to 1.10.5. But now I get a b.ntablewrapper is null the second time my code is executed.
Here is the code concerning Datatables:
$(document).ready(function() {
...
$('#form').submit( function() {
var id = $('#sql_req').children(":selected").attr("id");
var val = $('#sql_req').children(":selected").text();
if (id != 0) {
$("body").css("cursor", "wait");
$.ajax({
url: "getquery.php?reqsql="+encodeURIComponent(val),
dataType:'JSON',
success:function(json){
$("#example").find('thead tr th').remove();
$("#example").dataTable( {
"oLanguage": {
"sEmptyTable": "Pas de données dans la table",
"sInfo": "Visualisation des enregistrements _START_ à _END_ sur un total de _TOTAL_",
"sInfoEmpty": "Visualisation des enregistrements 0 à 0 sur un total de 0",
"sInfoFiltered": "(filtrés sur _MAX_ enregistrements au total)",
"sInfoPostFix": "",
"sThousands": " ",
"sLengthMenu": "Afficher _MENU_ lignes par page",
"sLoadingRecords": "Chargement...",
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher:",
"sZeroRecords": "Aucun enregistrement trouvé",
"oPaginate": {
"sFirst": "Début",
"sLast": "Fin",
"sNext": "Suivant",
"sPrevious": "Précédent"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne dans l'ordre ascendant",
"sSortDescending": ": activer pour trier la colonne dans l'ordre descendant"
}
},
"bDestroy": true,
"bProcessing": true,
"bPaginate": true,
"bDeferLoading": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 50,
"aaData": json.aaData,
"aoColumns": json.aoColumns
} );
$("body").css("cursor", "default");
}
} );
}
return false; // prevent the browser to submit the form by itself
} );
I've read the release notes by I cannot see what has changed.
Any help would be appreciated.
Thanks.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Can you link tot he page in question so I can draw and debug what is going wrong please? It might be that you need to add:
at the very start of your
success
function.Allan
Hi Allan.
Thanks for quick response.
I've tried your trick but it doesn't solve the problem.
At the second run, I now get a "col is undefined" at jquery.datatbales.js line 6376 (if ( col.mData === i ) {)
then for the next run a "settings.nTableWrapper is null" error at line 8982 col 7 (var orig = settings.nTableWrapper.parentNode;)
I've no public link to the page but I give you the full html code:
Thanks.
Michel.
Can you put the destroy call before the remove please?
Allan
I've swapped the lines and now has the following code:
I've also emptied the bowser cache but the problem still remains.
I'm afraid I would need a link to the page in that case. I'm not sure why that wouldn't work and I'll need to debug it.
Allan
Allan,
I've built a zip file with a simplified code that reproduce the problem. I cannot send you all my application since it needs mysql database, SQL scripts, php code, ... The zip file contains the datatable source I used and 1 html page and 2 php scripts used by the page. You don't need mysql to execute it but only apache2.2/PHP5.3.
The problem occurs when you choose a datatable with less columns than the previous one (for instance, choose 'test2' then 'test1' in the select box).
You can try this link to download the zip file:
http://ovh.to/xu4NNeu
Michel.
The link has expired. You can now use
http://ovh.to/8mS7mKL
Michel.
Hello Allan.
Have you had time to investigate my problem ?
If you need that I reactivate the link to the archive, let me know.
Thanks.
Michel.
It would be great if you could post the page up on the web somewhere that I can just load and debug it please.
Allan
Can you try http://testdatatables.pagesperso-orange.fr/ ?
you first select 'test2' in the combo (then click on submit) then 'test1' (and click on submit) and the problem occurs.
Michel.
There are no header cells, but there are cells in the tbody. Hence, DataTables gets confused.
Try:
Allan
YES ! it works fine now. Thanks a lot Allan.
This topic can be closed.
Michel.