Row width
Row width
Hi all,
When i render my datatable my rows to not fill the entire table body. There is always a 2-3 pixel gap to the right of the row including the header. I can see this whenever I underline a row or give it a back color and cannot for the life of me figure out what is causing it. Has anyone else experienced this problem and perhaps come up with a solution?
Below is the code I use to instantiate the table.
[code]
function CreateMessageTable(f) {
oTable = $('#messageTable').dataTable({
"bServerSide": true,
"sAjaxSource": f,
"bAutoWidth":false,
"oLanguage": { "sEmptyTable": "No messages found" },
"bProcessing": true,
"bLengthChange": false,
"bScrollInfinite": true,
"bProcessing": true,
"sScrollY": "275px",
"fnDrawCallback": function (oSettings){
for (var i = 0, il = oSettings.aoData.length; i < il; i++) {
if (oSettings.aoData[i]._aData[5] == "False") {
oSettings.aoData[i].nTr.className = " message_unread";
} else {
oSettings.aoData[i].nTr.className = " message_read";
}
}
},
"fnInitComplete": function (oSettings) {
for (var i = 0, il = oSettings.aoData.length; i < il; i++) {
if (oSettings.aoData[i]._aData[5] == "False") {
oSettings.aoData[i].nTr.className = " message_unread";
} else {
oSettings.aoData[i].nTr.className = " message_read";
}
}
},
"aoColumns": [
{ "sName": "Subject",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[0] + "";
} else {
return "" + oObj.aData[0] + "";
}
}
},
{ "sName": "Message Type",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[1] + "";
} else {
return "" + oObj.aData[1] + "";
}
}
},
{ "sName": "Date", "sType": "date",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[2] + "";
} else {
return "" + oObj.aData[2] + "";
}
}
}
]
});
}
[/code]
Edit: Thought this html might also be important
[code]
All Messages
Subject
Filing
Date
[/code]
Thanks in advance for any help,
JMorrison
When i render my datatable my rows to not fill the entire table body. There is always a 2-3 pixel gap to the right of the row including the header. I can see this whenever I underline a row or give it a back color and cannot for the life of me figure out what is causing it. Has anyone else experienced this problem and perhaps come up with a solution?
Below is the code I use to instantiate the table.
[code]
function CreateMessageTable(f) {
oTable = $('#messageTable').dataTable({
"bServerSide": true,
"sAjaxSource": f,
"bAutoWidth":false,
"oLanguage": { "sEmptyTable": "No messages found" },
"bProcessing": true,
"bLengthChange": false,
"bScrollInfinite": true,
"bProcessing": true,
"sScrollY": "275px",
"fnDrawCallback": function (oSettings){
for (var i = 0, il = oSettings.aoData.length; i < il; i++) {
if (oSettings.aoData[i]._aData[5] == "False") {
oSettings.aoData[i].nTr.className = " message_unread";
} else {
oSettings.aoData[i].nTr.className = " message_read";
}
}
},
"fnInitComplete": function (oSettings) {
for (var i = 0, il = oSettings.aoData.length; i < il; i++) {
if (oSettings.aoData[i]._aData[5] == "False") {
oSettings.aoData[i].nTr.className = " message_unread";
} else {
oSettings.aoData[i].nTr.className = " message_read";
}
}
},
"aoColumns": [
{ "sName": "Subject",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[0] + "";
} else {
return "" + oObj.aData[0] + "";
}
}
},
{ "sName": "Message Type",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[1] + "";
} else {
return "" + oObj.aData[1] + "";
}
}
},
{ "sName": "Date", "sType": "date",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
if (oObj.aData[5] == "True") {
return "" + oObj.aData[2] + "";
} else {
return "" + oObj.aData[2] + "";
}
}
}
]
});
}
[/code]
Edit: Thought this html might also be important
[code]
All Messages
Subject
Filing
Date
[/code]
Thanks in advance for any help,
JMorrison
This discussion has been closed.
Replies
Allan
http://tinypic.com/r/2hhqcm0/6
It seems that the width of the is generated at 697 px and the sum of the three s only sum to 693px. As you can see above all widths are set with percentages. If this is still not enough please let me know so I can try to give you more information. I would love to know how/why this is happening.
Many thanks,
JMorrison