Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Datatables init
scrollX: true
scrollY: '600px'
scrollCollapse: true
paging: false
destroy: true
dom: 'lrtip' # remove filter but keep 'searching' option in order to make column filter work
# table row select effect
$('#channels-table tbody tr').on 'click', (e)->
$(e.currentTarget).parents('table').find('tr.warning').removeClass 'warning'
$(e.currentTarget).addClass 'warning'
allowClear: true
# search on channel name
$("#channel-select2").on "change", (e)->
if !!e.val
dt = $('#channels-table').DataTable()
if dt.rows().length != 0
# find tr and click
indexes = dt.rows().eq( 0 ).filter (rowIdx)->
return dt.row(rowIdx).data()[0] == e.val
dt.rows( indexes ).nodes().to$().click()
# Scroll to make visible
# Uses JQuery.scrollTo.js
scrollArea = '.dataTables_scrollBody' #dt.fnSettings().nTable.parentNode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.