Showing row details as default in dataTables

Showing row details as default in dataTables

adromiladromil Posts: 53Questions: 4Answers: 0
edited May 2012 in DataTables 1.9
Hi All,

I just want to query if there is a way to display row details as shown in DataTables hidden row details example -where it expands the table row details- which I wanted to display on table load, instead of hiding it.

Thanks.

Replies

  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Just use the fnOpen function on the row in your document ready function after you've initialled the DataTable. You don't need to use fnOpen inside a 'click' handler like in my demo - it can be called programmatically from anywhere in your code.

    Allan
  • adromiladromil Posts: 53Questions: 4Answers: 0
    Thank you Allan for your inputs.

    Very well appreciated.
  • adromiladromil Posts: 53Questions: 4Answers: 0
    Hi Allan,

    I have an additional query for on this.

    Can I make the class same as its parents tr class and will also reflect or dynamically changed when sorted.

    I added [code]nTr.className[/code] on the generated TR element on fOpen but it is static and does not conform on the tr class where it is referenced.


    Thanks.
  • adromiladromil Posts: 53Questions: 4Answers: 0
    I read the Discussion on http://datatables.net/forums/discussion/9877/keep-class-when-using-fnopen/p1, however there are no example how to achieved this.

    my fOpen Code goes like this
    [code]
    var nTr;
    var tn = oTable.fnSettings().fnRecordsTotal();
    if(tn>0){
    for(var n=0; n
  • adromiladromil Posts: 53Questions: 4Answers: 0
    As I was trying to resolve this on my own, I come up using the fnOpen concept, thus I used the following code to maintain the td class (.details) parents TR class' same as the preceding TR class using this code:
    [code]
    "fnDrawCallback": function( oSettings ) {
    var theTR;
    var tRows = oSettings.fnRecordsTotal();
    var detailsTR;
    if(tRows>0){
    for(var i=0; i
This discussion has been closed.