Problems with sWidth
Problems with sWidth
earachefl
Posts: 11Questions: 0Answers: 0
Not having any luck setting sWidth either using aoColumns or aoColumnDef. I've tried both setting individual column widths and all column widths - currently, my setting is:
[code]"aoColumns": [
{ "sWidth": "9%" },
{ "sWidth": "7%" },
{ "sWidth": "22%" },
{ "sWidth": "22%" },
{ "sWidth": "11%" },
{ "sWidth": "13%" },
{ "sWidth": "8%" },
{ "sWidth": "8%" }
],[/code]
Somehow, IE8 works best, in that setting sWidth anywhere doesn't totally break the column sizing; still, in IE 8, nothing much happens when you change column sizes. In Chrome and FF, the table sizing is totally broken as soon as I add any sWidth parameters, and the entire table becomes about 2/3 of its normal width. I'm only able to control sizing through css.
[code]"aoColumns": [
{ "sWidth": "9%" },
{ "sWidth": "7%" },
{ "sWidth": "22%" },
{ "sWidth": "22%" },
{ "sWidth": "11%" },
{ "sWidth": "13%" },
{ "sWidth": "8%" },
{ "sWidth": "8%" }
],[/code]
Somehow, IE8 works best, in that setting sWidth anywhere doesn't totally break the column sizing; still, in IE 8, nothing much happens when you change column sizes. In Chrome and FF, the table sizing is totally broken as soon as I add any sWidth parameters, and the entire table becomes about 2/3 of its normal width. I'm only able to control sizing through css.
This discussion has been closed.
Replies
Table widths have always been wacky, because they're the one case in which width settings are seen by the browser as a "guideline" instead of a firm setting, and the browser can in many cases override your settings with what it thinks the values SHOULD be.
Back to sWidth: if the internal function related to sWidth allows for a total less than 100%, splitting the difference between any remaining columns, I would give that a try.
however, datatables does need to calculate widths in the header and tbody separately and force them to match up (not always successfully in my experience).