multiple rows and columnfilter
multiple rows and columnfilter
HerbertMarshall
Posts: 1Questions: 0Answers: 0
I found this post: http://datatables.net/forums/discussion/120/multiple-rows-per-record/p1 and the code snippet provided worked great, however I had the same problem as rafis23. I thought I would post my simple solution to the problem, in the event someone else needed some help.
I also modified the columnfilter to work with this set-up if anyone is interested.
http://datatables.net/forums/discussion/5033/datatables-column-filter-add-on-for-the-data-table/p1
[code]
"fnRowCallback": function( aRow, aData, iDisplayRow, iTableRow) {
var firstRow = aRow.cloneNode(true);
var secondRow = aRow.cloneNode(true);
var half = aData.length / 2;
$('td:gt(' + (half-1) + ')', firstRow).remove();
$('td:lt(' + half + ')', secondRow).remove();
var frag = document.createDocumentFragment();
frag.appendChild(firstRow);
frag.appendChild(secondRow);
return frag;
},
[/code]
P.S. I typed the corrections in here, so beware of typos. But you get the idea.
This could easily work with 3 or more rows if needed....
Cheers!
Herb
I also modified the columnfilter to work with this set-up if anyone is interested.
http://datatables.net/forums/discussion/5033/datatables-column-filter-add-on-for-the-data-table/p1
[code]
"fnRowCallback": function( aRow, aData, iDisplayRow, iTableRow) {
var firstRow = aRow.cloneNode(true);
var secondRow = aRow.cloneNode(true);
var half = aData.length / 2;
$('td:gt(' + (half-1) + ')', firstRow).remove();
$('td:lt(' + half + ')', secondRow).remove();
var frag = document.createDocumentFragment();
frag.appendChild(firstRow);
frag.appendChild(secondRow);
return frag;
},
[/code]
P.S. I typed the corrections in here, so beware of typos. But you get the idea.
This could easily work with 3 or more rows if needed....
Cheers!
Herb
This discussion has been closed.