Multitable Initialisation
Multitable Initialisation
hello,
I have one jsp page which includes drop-down list having options as all,first,second. when i initialise one by one table
there is no problem.But when I firstly select all and then first it shows error as' DataTables warning: Unable to re-initialise DataTable. Please use the API to make any configuration changes required'. why it is so??? and what would be the solution over it???
I have tried fnDraw() and making table to null,as options tried already,but the problem never solved.Please help me out as early as possible.
Thanks,
nilophar
I have one jsp page which includes drop-down list having options as all,first,second. when i initialise one by one table
there is no problem.But when I firstly select all and then first it shows error as' DataTables warning: Unable to re-initialise DataTable. Please use the API to make any configuration changes required'. why it is so??? and what would be the solution over it???
I have tried fnDraw() and making table to null,as options tried already,but the problem never solved.Please help me out as early as possible.
Thanks,
nilophar
This discussion has been closed.
Replies
Allan
[code]
function getSelectedValue() {
var getvalues = null;
if (!$("#items option:selected").length) {
$("#items option[value='All']").attr('selected', 'selected');
getvalues = $("#items").val();
firstTable();
secondTable();
} else {
getvalues = $("#items").val();
oFirstTable = null;
oSecondTable= null;
if (getvalues == "First") {
if (oFirstTable != null) {
oFirstTable .fnDraw();
return;
}
$("#firstTable").show();
firstTable();
}
if (getvalues == "Second") {
if(oSecondTable!=null)
{ oSecondTable.fnDraw();
return; }
$("#secondTable").show();
secondTable();
}
if (getvalues == "All") {
$("#firstTable").show();
$("#secondTable").show();
firstTable();
secondTable();
}
}
}
//first and second table initialisation
function firstTable() {
oFirstTable= firstTable.dataTable( {
"bPaginate" : true,
"bProcessing" : true,
"sPaginationType" : "full_numbers",
"oLanguage" : {
"sZeroRecords" : "No Results Found"
},
"bFilter" : false,
"bInfo" : true,
"bJQueryUI" : true,
"iDisplayLength" : 25,
"bLengthChange" : false,
"bSort" : false,
"aaData": [
[ "First"],
]
});
}
function secondTable() {
oSecondTable= secondTable.dataTable( {
"bPaginate" : true,
"bProcessing" : true,
"sPaginationType" : "full_numbers",
"oLanguage" : {
"sZeroRecords" : "No Results Found"
},
"bFilter" : false,
"bInfo" : true,
"bJQueryUI" : true,
"iDisplayLength" : 25,
"bLengthChange" : false,
"bSort" : false,
"aaData": [
[ "Second"],
]
});
}
[/code]
If calling datatable twice is not possible how should i overcome from this problem??
(*edited by Allan to add syntax highlighting - makes life that little bit easier :-) )
oFirstTable = firstTable.dataTable( {
[/code]
Should that be:
[code]
oFirstTable = $("#firstTable").dataTable( {
[/code]
?
Given that firstTable() looks recursive at the moment.
Can getSelectedValue() be called more than once? If so then I think that's the problem - you can't re-initialise a table, you need to use the API methods to get the information from the table - just like the alert says. If it's only called once, then I can't see a code path which would result in this error... (unless my above comment does the trick).
Allan
i used fnDaw() method but it does not work,can you please suggest me which API method to be called to do so???