New table is being created when I try to reload the existing table
New table is being created when I try to reload the existing table
pborregg
Posts: 59Questions: 2Answers: 0
Hi everyone.
So I have this dataTable that's giving me heartaches.
1 - I get the infamous message onLoad: Requested unknown parameter 1 for the datasource for row 1.
I'm using Handlebars to render my data with JAVA API's to retrieve it. Not using mData.
Here's my code:
[code]
var oTable = $('#example').dataTable({
sDom: dWithNoFR,
bDestroy: true,
//sPaginationType: "bootstrap", <-- THIS DOESN'T WORK
sPaginationType: "full_numbers",
oLanguage: {
sLengthMenu: "_MENU_ records per page"
},
aoColumns: [
{bSortable: false, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false}
],
bJQueryUI: true, //Make FALSE if using Bootstrap for sPaginationType
bFilter: false,
iDisplayLength: 10,
bProcessing: true,
aLengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
bPaginate: true,
bSortCellsTop: false,
aaSorting: [
[1, 'desc'],
[8, 'desc']
],
});
[/code]
So I'm trying to run code that will REPOPULATE the table with new data based on the users choice... there are 16 possible combinations.
Needless to say, the program is creating a "SECOND" datatable named "example" but only the header no data right below the original datatable.
2 - This is the call I'm using to TRY and clear the table: oTable.fnClearTable();
3 - Column header sorting works, but when you click on it once, the message above pops up and the rows disappear. When you click on it again (any column header) the rows come back, sorted.
Any thoughts, please?
Thanks,
Peter
So I have this dataTable that's giving me heartaches.
1 - I get the infamous message onLoad: Requested unknown parameter 1 for the datasource for row 1.
I'm using Handlebars to render my data with JAVA API's to retrieve it. Not using mData.
Here's my code:
[code]
var oTable = $('#example').dataTable({
sDom: dWithNoFR,
bDestroy: true,
//sPaginationType: "bootstrap", <-- THIS DOESN'T WORK
sPaginationType: "full_numbers",
oLanguage: {
sLengthMenu: "_MENU_ records per page"
},
aoColumns: [
{bSortable: false, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false},
{bSortable: true, bSearchable: false}
],
bJQueryUI: true, //Make FALSE if using Bootstrap for sPaginationType
bFilter: false,
iDisplayLength: 10,
bProcessing: true,
aLengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
bPaginate: true,
bSortCellsTop: false,
aaSorting: [
[1, 'desc'],
[8, 'desc']
],
});
[/code]
So I'm trying to run code that will REPOPULATE the table with new data based on the users choice... there are 16 possible combinations.
Needless to say, the program is creating a "SECOND" datatable named "example" but only the header no data right below the original datatable.
2 - This is the call I'm using to TRY and clear the table: oTable.fnClearTable();
3 - Column header sorting works, but when you click on it once, the message above pops up and the rows disappear. When you click on it again (any column header) the rows come back, sorted.
Any thoughts, please?
Thanks,
Peter
This discussion has been closed.
Replies
Allan
Update.... Data is coming in nicely, pagination is working, nicely, sort (not so much).
Sort (column header) removes all the rows, and the message displays the following:
Request Unknown Parameter 4 (it could be 1, 2, 3, 5, 6, 7, 8, 9 for each column) for the datasource for row 1....
Then the rows disappear.... click on the column header again and the rows come back; SORTED! Bizarre.
Last problem and I think this problem is solved:
I put a try, catch block in jquery.datatables.js around line 673 which is this function:
[code]
/* Classes */
if (bClass)
{
//FIXME - This is to correct a NO CLASS NAME of the hidden rows for the details
//PNB - 122813
try {
if (nCell.className === "hiddenRow" && nCell.className === "undefined" && oCol.sClass === "")
{
oCol.sClass = " details";
} else {
oCol.sClass = "";
}
try {
if(nCell.className === "")
{
nCell.className = " details"
}
} catch (e) {
if (e) {
console.log("The following errored out: nCell.className has no value. jquery.dataTable.js Line 673");
}
}
} catch (e) {
console.log("The following errored out: nCell.className has no value. jquery.dataTable.js Line 673");
}
}
[/code]
WHY? Well, since I have "hidden" rows for the details, every other row, starting at row 2 with row 0 being the Table Header row and row 1 the first row of data, the code errors out on the second CATCH block.
That's pretty much it. If I can solve this issue, I think I've nipped this in the bud.
Thanks, Allan.
I forgot, in the same JS file, I'm getting this error:
There was an error because nTds{i}.className is undefined... Line 4418
The real problam is:
Type of Error: TypeError - Cannot read property 'className' of undefined
Here's the code that starts around line 4396:
[code]
for (i = 0, iLen = nTds.length; i < iLen; i++)
{
//FIXME: iLen doesn't get defined...towards the end
if(iLen !== "undefined")
{
/* Determine which column we're looking at */
iTargetCol = i % iColumns;
/* What is the full list of classes now */
//Added this for Hidden DRAWER rows...
//PNB 122813 -- If we're using accordion tables this fixes the problem
try {
if (nTds[i].className !== "hiddenRow" && nTds[i].className !== "undefined")
{
sCurrentClass = nTds[i].className;
/* What sorting class should be applied? */
sNewClass = asClasses[iTargetCol];
/* What would the new full list be if we did a replacement? */
sTmpClass = sCurrentClass.replace(reClass, sNewClass);
if (sTmpClass != sCurrentClass)
{
/* We changed something */
nTds[i].className = $.trim(sTmpClass);
}
else if (sNewClass.length > 0 && sCurrentClass.indexOf(sNewClass) == -1)
{
/* We need to add a class */
nTds[i].className = sCurrentClass + " " + sNewClass;
}
} if(nTds[i].className !== "undefined") {
nTds[i].className = " " + sNewClass;
} else {
nTds[i].className = " colspacedDead"
}
} catch (e) {
if (e) {
console.log("There was an error because nTds{i}.className is undefined... Line 4418\nThe real problam is:\n\
Type of Error: " + e.name + " - " + e.message);
}
}
}
[/code]
Thanks