Dom => Layout conversion

Dom => Layout conversion

adi76adi76 Posts: 2Questions: 1Answers: 0

How to convert this DataTables 1.x configuration:

$.extend($.fn.dataTable.defaults, {
dom: '<"datatable-scroll-wrap"t><"datatable-footer"ip>'
});

to new layout option available in DataTable 2.x

I have a problem how to define css class names in layout structure.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,298Questions: 26Answers: 4,944
    Answer ✓

    Its not available yet but is expected in Datatables 2.1. See this thread.

    Kevin

  • allanallan Posts: 63,441Questions: 1Answers: 10,459 Site admin

    In 2.1 that will be:

    DataTable.ext.classes.layout.tableCell = 'datatable-scroll-wrap';
    

    to set the class for the table wrapper (since that can't be done with layout. And for the remainder:

    layout: {
      topStart: null,
      topEnd: null,
      bottomStart: null,
      bottomEnd: null,
      bottom: {
        className: 'datatable-footer',
        features: [ 'info', 'paging' ]
      }
    }
    

    to exactly match what you currently have. Or a little simpler:

    layout: {
      topStart: null,
      topEnd: null
    }
    

    Which doesn't add the datatable-footer element, but I expect will still lay it out as expected. It depends on what classes you have.

    Allan

  • adi76adi76 Posts: 2Questions: 1Answers: 0

    Thank you for your answer.
    Waiting for 2.1 version...

  • allanallan Posts: 63,441Questions: 1Answers: 10,459 Site admin

    Should be available in about 2 weeks time. I'm going on holiday next week, and for all that I'll have my laptop with me, I don't want to release it (or even merge to master) just in case something goes wrong (it shouldn't - all the unit tests are passing)! Merge to master (i.e. the nightly build) should be in 1 week.

    Allan

Sign In or Register to comment.