Integration Of Row Grouping and Fixed Column
Integration Of Row Grouping and Fixed Column
nikhilrn
Posts: 4Questions: 0Answers: 0
Hey Allan.. Finally got into the discussion room.. As I was telling you, I tried integrating your two examples, Row grouping and Fixed Columns. I was not able to initialise the ROW GROUPING code to FIX a column so that, the similar entries in that column would be grouped and Spaned. I hope you got where I am stuck:(. Please help me out..
Regards,
Nikhil
Regards,
Nikhil
This discussion has been closed.
Replies
Allan
$(document).ready( function () {
var oTable =$('#example').dataTable({
"sScrollY": "300px",
"sScrollX": "100%",
"sScrollXInner": "50%",
"bScrollCollapse": true,
"bPaginate": false
} ).rowGrouping({ iGroupingColumnIndex2: 1,
sGroupLabelPrefix: "Row 1 grouped",
sGroupLabelPrefix2: "Row 2 grouped ",
bHideGroupingColumn2: false});
new FixedColumns( oTable, {
"iLeftWidth": 150,
"fnDrawCallback": function ( left, right ) {
var that = this, groupVal = null, matches = 0, heights = [], index = -1;
/* Get the heights of the cells and remove redundant ones */
$('tbody tr td', left.body).each( function ( i ) {
var currVal = this.innerHTML;
/* Reset values on new cell data. */
if (currVal != groupVal) {
groupVal = currVal;
index++;
heights[index] = 0;
matches = 0;
} else {
matches++;
}
heights[ index ] += $(this.parentNode).height();
if ( currVal == groupVal && matches > 0 ) {
this.parentNode.parentNode.removeChild(this.parentNode);
}
} );
/* Now set the height of the cells which remain, from the summed heights */
$('tbody tr td', left.body).each( function ( i ) {
that.fnSetRowHeight( this.parentNode, heights[i] );
} );
}
} );
});
I hope u came to know that the above snippet is the onload script of ROW GROUPING. By this above code, I am able to group by TWO ROWS. But as I said, I need ROW GROUPING as well as FIXED COLUMN.
Help me out please..
Regards,
Nikhil
Awating your response..
Regards,
Nikhil
Hi, it would be really helpful to know how to integrate these 2.