require( 'datatables.net-zf' ), no style render table

require( 'datatables.net-zf' ), no style render table

pig800509pig800509 Posts: 12Questions: 2Answers: 0

As title said, I use these code in react component

require( 'datatables.net-zf' ); 

.......

$('#example').DataTable( {
        dom: "Bfrtip",
        data: dataSet.data,
        columns: [
            { data: null, render: function ( data, type, row ) {
                // Combine the first and last names into a single table field
                return data.first_name+' '+data.last_name;
            } },
            { data: "position" },
            { data: "office" },
            { data: "extn" },
            { data: "start_date" },
            { data: "salary", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: true
    } );

No style render table,
Should I import css ? But css folder already exist in that package(node_modules/datatables.net-zf/css)
I have tried Import 'datatables.net-zf'; that is useless.

thank you

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    We'd really need a link to a page showing the issue. I'm not sure if the issue is a style not being loaded, Zurb not having its table styles, or something else.

    Allan

  • pig800509pig800509 Posts: 12Questions: 2Answers: 0

    import dataTables.foundation.css doesn't work,either, but

    import './css/jquery.dataTables.min.css';
    require( 'datatables.net' );     
    

    work perfectly, I think something is wrong in all styling package, I give up to use styling dataTables in create-react-app, maybe I can use to the basic style.

    Thanks

This discussion has been closed.