some columns are not wide enough
some columns are not wide enough
kkudi
Posts: 77Questions: 0Answers: 0
have a datatable which is generated following a json response and it works well.
However, a couple of columns (e.g 2 out of 50 columns) are not wide enough and they cause that column to be unreadable.
Img: how this looks like: http://i.stack.imgur.com/8GZ1y.png
[code]
dt = $('#table').dataTable({
"sScrollX" : "100%",
"bScrollCollapse" : true,
"iDisplayLength" : 50,
"bRetrieve" : true,
"bAutoWidth" : true,
"aoColumnDefs" : this.JSON2DataTableHelper(data[0])
});
this.add(dt, data);
dt.fnAdjustColumnSizing();
JSON2DataTableHelper = function(object) {
var aoColumns = [];
var i = 0;
for ( var key in object) {
if (object.hasOwnProperty(key)) {
var obj =
{
mData : key,
sTitle : key,
aTargets : [ i ],
};
aoColumns.push(obj);
i++;
}
}
return aoColumns;
}
add = function(dt, data) {
dt.fnAddData(data);
}
[/code]
However, a couple of columns (e.g 2 out of 50 columns) are not wide enough and they cause that column to be unreadable.
Img: how this looks like: http://i.stack.imgur.com/8GZ1y.png
[code]
dt = $('#table').dataTable({
"sScrollX" : "100%",
"bScrollCollapse" : true,
"iDisplayLength" : 50,
"bRetrieve" : true,
"bAutoWidth" : true,
"aoColumnDefs" : this.JSON2DataTableHelper(data[0])
});
this.add(dt, data);
dt.fnAdjustColumnSizing();
JSON2DataTableHelper = function(object) {
var aoColumns = [];
var i = 0;
for ( var key in object) {
if (object.hasOwnProperty(key)) {
var obj =
{
mData : key,
sTitle : key,
aTargets : [ i ],
};
aoColumns.push(obj);
i++;
}
}
return aoColumns;
}
add = function(dt, data) {
dt.fnAddData(data);
}
[/code]
This discussion has been closed.
Replies