Datatables - Rowspan in <tbody>: Cannot read Property 'classname' of Undefined

Asked

Viewed 260 times

1

I am using Jquery and the Datatable plugin in my tables. So in some situations I need to use rowspan in the body (tbody) of my tables, which generates the following error in Google Chrome and ends up not applying the plugin: Uncaught TypeError: Cannot read property 'className' of undefined

I read about the plugin fakeRowspan, but either it didn’t work or I couldn’t use it properly.

See the fiddle below with the problem:

Fiddle

  • What is the expected result?

2 answers

1

Boy, I took a look at that plugin jquery.datatable.js and it has approx 12,000 lines.

To avoid error I added the test in the error line 669:

if(nCell)
    nCell.className += ' '+oCol.sClass;

Then he began to give an alert that I commented on the lines, 781 to 784:

/*
_fnLog( oSettings, 0, "Requested unknown parameter "+
(typeof oCol.mData=='function' ? '{mData function}' : "'"+oCol.mData+"'")+ 
" from the data source for row "+iRow );
oSettings.iDrawError = oSettings.iDraw;
*/

Follow the JSFIDDLE link : http://jsfiddle.net/9mkHz/7/

  • Hello Rogerio, I checked your Fiddle, but it seems that the plugin was not applied properly due to the modifications you had to insert.

  • 1

    @mayconfsbrito, given the complexity of the plugin I find it kind of difficult to solve this problem quickly. I suggest you look at their page and see if this plugin gives support for what you want to do.

  • 2

    Thanks Rogerio. I’ll look at the Datatables forum itself.

0

I know this reply of mine won’t solve your problem (and I did a lot of research on it and the only reference I found the link to it no longer existed, as you can see in this link) But here are some tips on your table to avoid future problems with your code:

  • You have repeated id’s on it, for example: #tabelainfo and #corpotabela;
  • Colspan and rowspan properties when values equal to 1 are not required;
  • The tag has been discontinued, it is recommended to use CSS for this;
  • The "align" property in td’s is also not recommended, so use CSS;
  • There are missing rows in the table, in this mix of rows and columns some have been forgotten, to know where they are put a border="1" in the table and see the empty spaces, this will surely avoid future problems in the dataTables itself().

Remembering that above are just tips I realized while searching for a resolution to your problem by looking at your fiddle’s versioning 6.

As I am currently working with Datatables as well and having some problems with it, I will keep searching and if I find a solution to this doubt I will come back here again.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.