arun nagar
arun nagar

Reputation: 19

How to override Automatic column hiding in responsive jquery Datatable plugin?

I want to have horizontal scrolling in the jquery datatable responsive web design. But when i use the responsive plugin for datatable the ScrollX doesnot work.

I read this on thier page:

Columns that that don't fit into the available area are removed automatically

<script src="https://cdn.datatables.net/responsive/1.0.7/js/dataTables.responsive.min.js"></script>

You can see example here.

Resize the window to see that columns are automatically hiding but i want to place a scroll if columns overflow the screen size.

i tried fixing it with Css but no use.

Any solution?

Upvotes: 0

Views: 2486

Answers (1)

Tienou
Tienou

Reputation: 720

You don't need to use dataTables.responsive.min.js, the normal jquery.dataTables.min.js is enough if you just want to scroll. you can do it like this:

$("#yourTable").DataTable({
    "scrollY": 200,
    "scrollX": true
});

Check out the documentation as well: https://datatables.net/reference/option/scrollX

Hope that helps

Upvotes: 2

Related Questions