Is there a way to automatically expand the row when using the Responsive Extension?

Is there a way to automatically expand the row when using the Responsive Extension?

adromiladromil Posts: 53Questions: 4Answers: 0

I have tried the Responsive Extension and I have been wondering if there is a way to automatically expand the row dataTable is in responsive design so that users don't have to click or tap the corresponding control object assigned.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    edited July 2014

    Not built in, but you could listen for the column-visibility event and trigger the child rows to be shown when the table is collapsed.

    Nice idea for a future enhancement in the code though. I'll add it to the list :-)

    Allan

  • adromiladromil Posts: 53Questions: 4Answers: 0

    Hi Allan,

    Thank you for your usual prompt response, I have posted a question just right now,
    http://www.datatables.net/forums/discussion/22583/how-to-get-total-rows#latest
    asking how to get the total rows to replicate the function:

        function expandrows(oTable) {
            var nTr; 
            var tn = oTable.fnSettings().fnRecordsTotal();
            for(var n=0; n<tn; n++){
                nTr = $('#tblhist tbody td img').parents('tr')[n];
                oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
            }
    
        }
    

    which I created using the row_details API example.

    Your inputs is much appreciated.

    Best regards

  • adromiladromil Posts: 53Questions: 4Answers: 0

    In addition, using oTable.length API doesn't return the correct number of row in the table, I am also using a server-side source for the dataTables to render.

    Thank you very much

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Use page.info().

    Allan

This discussion has been closed.