Losing format when resize table

Losing format when resize table

Gnorro1976Gnorro1976 Posts: 8Questions: 5Answers: 0

Hi

I use responsive datatable
I have some date fields that are correctly formatted with a custoom function that converts millis do date in fnRowCallback event. But when I resize table format seems to disappear and are displayed the millis.

Do I have to change the event?

Thanks

Answers

  • Gnorro1976Gnorro1976 Posts: 8Questions: 5Answers: 0

    Using the following I can set a custom format. The problem is that it applies to every field. So if I want to format only dates I need to do that only on date fields, but I don't know how to do that.

    "responsive": {
                details: {
                    renderer: function ( api, rowIdx ) {
                        var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
                            var header = $( api.column( cell.column ).header() );
     
                            return '<li>'+
                                    '<span class="dtr-title">'+
                                        header.text()+':'+
                                    '</span> '+
                                    '<span class="dtr-data">'+
                                        dateFromMillisToString(api.cell( cell ).data())+
                                    '</span>'+
                                '</li>';
                        } ).toArray().join('');
     
                        return data ?
                            $('<ul class="child" colspan="2" />').append( data ) :
                            false;
                        }
                }
            }
    
This discussion has been closed.