Remove only horizontal scrollbar

Remove only horizontal scrollbar

deepabgdeepabg Posts: 1Questions: 1Answers: 0

Hi Team,
How can I remove horizontal scroll bar from table as I'm facing alignment issue for header and data.Once I scroll to right the data gets aligned,otherwise header and data alignment are mismatched.Could anyone suggest me how to remove horizontal scroll.

Below is my code,options I have used:

$.get("dyndata.jsp",function(data){

var x= JSON.parse(data);
var cols = [];
var exampleRecord = x[0];
//get keys in object. This will only work if your statement remains true that all objects have identical keys
var keys = Object.keys(exampleRecord);
//for each key, add a column definition
keys.forEach(function(k) {
//alert("k "+k)
cols.push({
title: k,
data: k
//optionally do some type detection here for render function
});
});

//initialize DataTables
var table = $('#example').DataTable({
scrollY: "500px",
scrollX: true,
scrollCollapse: false,
paging: false,
ordering:false,
columns: cols
});

//add data and draw
table.rows.add(x).draw();
highllight();

});

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You are setting the horizontal scroll bar yourself:

    scrollX: true,
    
This discussion has been closed.