Datatable's fixed header adds width and min-width when scrolls down
Datatable's fixed header adds width and min-width when scrolls down
Ariharan_Lothbrok
Posts: 1Questions: 0Answers: 0
Im newbie rails developer in my application i have used datatable for my tables.
In Tables, the fixedHeader causes some additional widths and min-widths when we scroll down and re-sync with header, i will attach my datatable's option below for your reference i dont know the cause of issue, i assumed that this might related to fixedHeader because when i set fixedHeader to false the issue doesn't occurs.
@table = $($table).DataTable(
stateSave: true
stateDuration: 60 * 60 * 24 * 7 # save state for a week
columns: table_cols()
serverSide: true
processing:true
pagingType: "input",
sDom: '<"top">rt<"bottom"fipl><"clear">'
sPaginationType: 'simple_numbers'
iDisplayLength: 15
bAutoWidth: false
autoWidth: false
fixedColumns: true
fixedHeader: {
headerOffset: MENU_OUTER_HEIGHT
}
order: that.col_to_sort($table)
aaSorting: that.col_to_sort($table)
ajax:
url: dataUri
data: (thing) =>
for columnData in thing.columns
columnData.orderable = undefined
columnData.search = undefined
columnData.s = columnData.searchable
columnData.searchable = undefined
thing.filter = @filter_data()
thing
stateSaveParams: (settings,data) ->
data['filter'] = DataTable.filter_object
'aLengthMenu': [
[10, 15,25 ,50, 100], [10, 15,25 ,50, 100]
]
'oLanguage':
'sLengthMenu': '_MENU_',
'szeroRecords': 'Nothing found - sorry',
'sInfo': '_MAX_ records found',
'sInfoEmpty': 'No records',
'sInfoFiltered': '(filtered from _MAX_ total records)',
'oPaginate':
'sPrevious': '<a href="#" class="btn btn-sm default next"> <%= image_tag 'ico-prev@3x.png',alt:' ' %></a>',
'sNext': '<a href="#" class="btn btn-sm default next"> <%= image_tag 'ico-next@3x.png',alt:' ' %></a>',
'bSortable': true
'sProcessing': '<div class="table-loader">
<%= image_tag 'logo.png', alt: " "%>
<div class="preloader-underline"></div>
</div>'
)
.on( 'stateSaveParams.dt', (e, settings, data) ->
data['filter'] = that.filter_data()
)
.on('init.dt',() ->
id = this.id
localstorage_key = 'DataTables_' + id + '_' + window.location.pathname
if Storage.get(localstorage_key)
DataTable.filter_object = Storage.get(localstorage_key).filter
else
DataTable.filter_object = {}
)
return this
Replies
If you could link to a test case showing the issue that would let me debug the problem.
Thanks,
Allan