Datatable full child row

Datatable full child row

dathtitdathtit Posts: 7Questions: 0Answers: 0
edited March 2014 in DataTables 1.10
Hi everyone
First, thank Alan for the new row child feature in the new Datatable 1.10 version.
Here's the question:
I want to create child row width the same format as parent row. It's like simply add a row to the table with the same column.
But now, the row child added always be put in a element with colspan like this



1
2
3




How can it just simply be like this :

1
2
3


I have try all the type of parameter can be put in row.child() : string, jquery, array but it just can't happen.
Please show me how to do this, or at least the code to fix this.
Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It looks like there is a bug in the new feature here unfortunately... It should be possible to do something like this: http://live.datatables.net/harurej/1/edit

    And have the child row matching the parent columns.

    Looking at the code, I think I see the problem: https://github.com/DataTables/DataTablesSrc/blob/master/js/api/api.row.details.js#L8

    > toUpperCase() !== 'tr'

    doh... It should be `TR` .

    I'm not in the office at the moment, but when I am I'll test and commit that.

    Allan
  • dathtitdathtit Posts: 7Questions: 0Answers: 0
    Thank Alan, fortunately it is a bug. I've thought it is designed that way.
    Anyway, I found a way to fix this temporarily.
    In this function, just make row._details = $(data);

    var __details_add = function ( ctx, row, data, klass )
    {
    // Convert to array of TR elements
    //var rows = [];
    //var addRow = function ( r, k ) {
    // if ( ! r.nodeName || r.nodeName.toUpperCase() !== 'tr' ) {
    // r = $('').find('td').html( r ).parent();
    // }

    // $('td', r).addClass( k )[0].colSpan = _fnVisbleColumns( ctx );
    // rows.push( r[0] );
    //};

    //if ( $.isArray( data ) || data instanceof $ ) {
    // for ( var i=0, ien=data.length ; i
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Heh - nice one :-)

    Allan
  • SaquibSaquib Posts: 1Questions: 0Answers: 0

    Hello Allan,

    Can you share the part of the code that'll fix it. What dathtit said is not working for me.

    Thank you

This discussion has been closed.