3

I'm using data tables with responsive plugin,

https://cdn.datatables.net/responsive/2.1.1/css/responsive.dataTables.css
https://cdn.datatables.net/responsive/2.1.1/js/dataTables.responsive.js

Here is my screen result:

Desktop view: view on desktop mode

Mobile view top:

mobile view 1

Mobile view bottom:

mobile view 2

My JS code:

    dataTable = $('#agency_data').DataTable({
    "processing":true,
    "serverSide":true,
    "order":[],
    responsive: true,

    "language": {
    "infoFiltered": ""
    },
    "ajax":{
        url:base_url+"/agency-listing",
        type:"POST"
    },
    "columnDefs":[
        {
            "targets":[0, 3], //first and last not sortable
            "orderable":false,
        },          
    ],

}); 

My table's HTML:

        <table id="agency_data" class="table table-bordered table-striped">
        <thead>
        <tr class="info">
        <th width="10%">ID</th>
        <th width="15%">Agency Code</th>
        <th width="65%">Agency Name</th>
        <th width="15%">Action</th>
        </tr>
        </thead>
        </table>

JSFIDDLE: HERE

Question:

1) On mobile view, how to get the Long organization name, showing perfectly? like BR?

2) How to get rid the horizontal scroll on the bottom, so that user no need to scroll on mobile view?

1 Answer 1

8

added : width="100%" into table solved the problem

<table id="agency_data" class="table table-bordered table-striped" width="100%">
Sign up to request clarification or add additional context in comments.

1 Comment

If it is solved your problem, then please accept your own answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.