Excluding the header in autowidth calculation
Excluding the header in autowidth calculation
I'm trying to implement something like the individual column filtering example except with the inputs under the header instead of under the footer (not that I expect that to make a difference). I'm also using bAutoWidth and the inputs are set to width: 100%; using css so they take up the entire width of the column. Things render fine at first, but after that the problem I'm having is that when fnAdjustColumnSizing adjusts the widths of the columns it takes the width of the inputs into account when calculating the size of each column. This causes a wierd effect where the largest column keeps getting larger and the smaller columns keep getting smaller each time they are resized, which I believe is because after the columns are resized it causes the width of the inputs to change which will then affect the next resize.
My question is: Is there a way (easy or hard) to exclude some rows (particularly those of the header or footer) from being considered in the autowidth calculation?
I'm also using the Scroller plugin, which seems to do quite a bit of dom rearranging. I'm creating the toolbar like this:
[code]
var grid = $('#gridId');
grid.dataTable({
bJQueryUI: true,
sDom: 'rtS',
sScrollY: 200,
bAutoWidth: true
});
var filterToolbar = $('');
for (var i = 0; i < colCount; ++i) {
var $th = $('');
var input = $('');
input.keydown(function() {
grid.fnFilter($(this).val(), i);
});
$th.append(input);
filterToolbar.append($th);
}
grid.closest('.dataTables_wrapper').find('.dataTables_scrollHead thead')
.append(filterToolbar);
[/code]
I've noticed that the filter toolbar seems to be getting cloned and copied into a zero width row at the top of the actual table (with Scroller the header and table are separate tables).
My question is: Is there a way (easy or hard) to exclude some rows (particularly those of the header or footer) from being considered in the autowidth calculation?
I'm also using the Scroller plugin, which seems to do quite a bit of dom rearranging. I'm creating the toolbar like this:
[code]
var grid = $('#gridId');
grid.dataTable({
bJQueryUI: true,
sDom: 'rtS',
sScrollY: 200,
bAutoWidth: true
});
var filterToolbar = $('');
for (var i = 0; i < colCount; ++i) {
var $th = $('');
var input = $('');
input.keydown(function() {
grid.fnFilter($(this).val(), i);
});
$th.append(input);
filterToolbar.append($th);
}
grid.closest('.dataTables_wrapper').find('.dataTables_scrollHead thead')
.append(filterToolbar);
[/code]
I've noticed that the filter toolbar seems to be getting cloned and copied into a zero width row at the top of the actual table (with Scroller the header and table are separate tables).
This discussion has been closed.