fixing column disables tr on click

fixing column disables tr on click

itassetsitassets Posts: 17Questions: 1Answers: 0

DataTable setup:
oTable = $('#planning').dataTable({
"aaData": dataSource["aaData"],
"aoColumns": tableColumns,
"bFilter":false,
"bSort":false,
"sScrollX": "100%",
"bScrollCollapse": true,
"bInfo":false,
"bLengthChange":true,
"bPaginate":false
});

        /* first column fixed */    
    new $.fn.dataTable.FixedColumns( oTable, {
            leftColumns: 1,
            rightColumns: 0
        });

            /* listen clicks on first column */
    $(document).on( "click", "#planning td:first-child", function() {
           var nTr = getSelectedRow($(this).html());
             toogleRow($(this).closest('tr'), nTr);
    }); 

Problem is, clicks on the first column are not captured on the first column in the table if new $.fn.dataTable.FixedColumns( oTable, {.... is executed. If no fixed column is set, clicks on the 1st column works properly.
Need both things to work together, any suggestion?

Replies

  • itassetsitassets Posts: 17Questions: 1Answers: 0

    I've solded this just binding the click event to the column before calling to new $.f.dataTable.FixedColumns....

    Hope this could help others. :)

  • sciszewski@salesapex.comsciszewski@salesapex.com Posts: 10Questions: 0Answers: 0

    I fixed teh first column, but I needed access to the custom attribute containing an ID that I need when the users clicks the on the first column. Here's how I did it. I had to put the event listener on the tr belonging to the fixed column. Then I had to pick up the ID from the underlying table.

                //add click event on name column
                $('#tblRpt .DTFC_ScrollWrapper .DTFC_LeftBodyLiner tbody').on('click', 'tr',
                    function (event) {
                        //get the id of the row
                        var rowID = $('#pivotGrid tr').eq(this.rowIndex).attr('id');
                        //get the text of the current row
                        var rowText = $('td', this).eq(0).text();
                        //now call the buildMenuPanel function
                        var location = { y: event.pageY, x: event.pageX };
                        buildMenuPanel(rowID, rowText, location);
                    }
                );
    
This discussion has been closed.