unexpected no of td elements
unexpected no of td elements
28.vivek.s
Posts: 69Questions: 0Answers: 0
hi Allan,
i am getting an alert message i.e.
DataTables warning: Unexpected number of TD elements. Expected 8 and get 2.
while in my table there are 2 rows and 8 colomn.the first thing is why dataTable is not reading 2nd row and second thing is why its getting only 2 cells in first row,while it have 8 cells..here is my table structure.
[code]
ID and Description
Type
Format
VendorId
ReqNo
Date
Availability
Size
CW-MICROCONTROLLERS
IDE - Debug, Compile and Build Tools
-
html
-
-
5/24/2010
yes
CW MCU v6.2 PE Update v3.04
Updates & Patches
-
exe
199441
3.04
10/24/2008
-
[/code]
please help me out.
thanks in advance
regards
vivek
i am getting an alert message i.e.
DataTables warning: Unexpected number of TD elements. Expected 8 and get 2.
while in my table there are 2 rows and 8 colomn.the first thing is why dataTable is not reading 2nd row and second thing is why its getting only 2 cells in first row,while it have 8 cells..here is my table structure.
[code]
ID and Description
Type
Format
VendorId
ReqNo
Date
Availability
Size
CW-MICROCONTROLLERS
IDE - Debug, Compile and Build Tools
-
html
-
-
5/24/2010
yes
CW MCU v6.2 PE Update v3.04
Updates & Patches
-
exe
199441
3.04
10/24/2008
-
[/code]
please help me out.
thanks in advance
regards
vivek
This discussion has been closed.
Replies
Allan
thanks for quick reply.i solved this issue.
but i came up with another problem in filtering logic.
suppose i passes abc in fnFilter(), then its giving me all data which starts from abc.
how to fix it.
please tell me.
i tried by appending "^" before string something like "^"+abc and then passed it into fnFilter,
but then i getting no matching records found.
if you have already discussed this thing then please give me the URL of that discussion.
thanks,
vivek
Allan
i have already done that,but still i m getting same issue.
here is my code
[code]
$(document).ready(function() {
var oTable = jQuery('#CacheSearchResultsTable').dataTable();
var linkLineData = document.getElementById("linkline").value;
if((linkLineData=="Data Sheets" || linkLineData=="Application Notes") && linkLineData != undefined){
linkLineData = "^"+linkLineData;
oTable.fnFilter(linkLineData,1,false);
}
});
[/code]
Please let me know, where i am wrong.
Thanks Vivek
Allan
i wonder whats going on,because the same thing i did with my other code and there it's working fine.
i tried with this code too.
[code]oTable.fnFilter(linkLineData,1,false,false);[/code]
as you said,but still same issue-"no matching records found".
I would like to remind you that i m using dataTable version 1.6.2.
please help me out.
thanks a lot for your quick response
Vivek
[code]
oTable.fnFilter(linkLineData,1,true,false);
[/code]
Note also that this will match at the start of the row only, since you are testing the entire row (and the strings are concatenated together with a double space separator). If you want to match the "start" of a string (i.e. a new cell) in the middle or a row, you'll need to take this into account as well.
Allan
still i am trying,if will get any solution i will get back to you.
here is my previous code....on click of a button i m calling this function.
[code]
function submitData(str,iColumn)
{
var container = "";
jQuery("#"+str+" :checked").each(function() {
if(container.length==0){
container = "^"+jQuery(this).val().LTrim();
container= fnEscapeRegex(container);
}
else{
container += "|" +"^"+jQuery(this).val().LTrim();
container= fnEscapeRegex ( container);
}
});
if(container.length>0){
oTable.fnFilter([container],iColumn,false);
}
else{
oTable.fnFilter('',iColumn,false);
}
}
[/code]
This code is working properly.
now,i can not upgrade version,because after couple of days code will pushed to production site.
so, till then i have to stick with this version only.
Vivek
i solved this issue by appending this regular expression in string before passing it to fnFilter()...
here is my code
[code]
function submitData(str,iColumn)
{
var container = "";
jQuery("#"+str+" :checked").each(function() {
if(container.length==0){
container = "^\\s*"+jQuery(this).val().LTrim()+"\\s*$";
container= fnEscapeRegex(container);
}
else{
container += "|"+ "^\\s*"+jQuery(this).val().LTrim()+"\\s*$";
container= fnEscapeRegex ( container);
}
});
if(container.length>0){
oTable.fnFilter([container],iColumn,false);
}
else{
oTable.fnFilter('',iColumn,false);
}
}
[/code]
And it's working fine in all version of DataTable.
Once again thanks for such a good plug-in.
Thanks,
Vivek