Integration Of Row Grouping and Fixed Column

Integration Of Row Grouping and Fixed Column

nikhilrnnikhilrn Posts: 4Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
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

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Can you show us how far you've managed to get integrating the two together please?

    Allan
  • nikhilrnnikhilrn Posts: 4Questions: 0Answers: 0
    edited August 2011
    Hey Allan.. I am posting the code snippet which i tried in yours.

    $(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
  • nikhilrnnikhilrn Posts: 4Questions: 0Answers: 0
    Hey Allan... I could not any response from you...
    Awating your response..

    Regards,
    Nikhil
  • jgilsenanjgilsenan Posts: 1Questions: 0Answers: 0

    Hi, it would be really helpful to know how to integrate these 2.

This discussion has been closed.