Resizing columns when modifying data
Resizing columns when modifying data
peterkronenberg
Posts: 112Questions: 0Answers: 0
I'm need to add an extra column to my data. I start out by adding an empty column in each row in the aaData that is passed in. I'm using aoColumnDefs to set a unique class for this column. I then add the data. But the column is not resizing properly. I'm using bAutoWidth (by default).
I tried setting sWidth in aoColumnDefs but that doesn't seem to have any effect. Also tried calling fnAdjustColumnSizing, also with no effect.
I tried setting sWidth in aoColumnDefs but that doesn't seem to have any effect. Also tried calling fnAdjustColumnSizing, also with no effect.
This discussion has been closed.
Replies
Allan
Allan
Then, after DataTables is initialized, I modify the data.
Really, what I'm trying to do is to place a button to the right of each row, for example, Delete. So the user can click on it and delete the row. So it's metadata. It's not really part of my data, but since it is associated with each row, it makes sense to put it in the table.
Allan
Here is the code showing DataTables initialized with an empty column (for all examples, just choose the first table in the dropdown): http://www.nova.org/~pak/test/emptyColumn.html
Here is what it looks like after data is added to the last row: http://www.nova.org/~pak/test/buttonColumn.html .
See around line 169 of http://www.nova.org/~pak/test/js/buttonColumn.js to see how the data is being added.
And here is a final example, using text instead of buttons, since I thought maybe the button HTML was throwing things off: http://www.nova.org/~pak/test/textColumn.html
Notice also in the last 2 examples that the FixedHeader columns are not being adjusted at all.
Notice also that http://www.nova.org/~pak/test/css/style.css has an explicit
[code]
#mainTable tbody tr td.editButtons {
width: 100px;
}
[/code]
but for some reason, the calculated width is not honoring this. I don't want to have this line in the css at all. I put it in just to see if I could force the width to expand.
Allan
http://www.nova.org/~pak/test/emptyColumn.png
http://www.nova.org/~pak/test/textColumn.png
At least you are seeing the problem with the FixedHeader, so I'm not totally crazy :-)