Skip to content

Commit

Permalink
Don't use deprecated API (fnDraw, fnSettings, etc...)
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rodriguez committed Feb 16, 2024
1 parent 8f9ed12 commit 86e87e7
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/model/datatable_filter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DatatableFilter extends Extendable
# Set datatable instance
@dt_id = @datatable.dt_id_strip
@dt_class = @datatable.dt_class
@instance = @datatable.datatable.settings()[0].oInstance
@instance = @datatable.datatable


load: ->
Expand Down Expand Up @@ -179,7 +179,7 @@ class DatatableFilter extends Extendable
_dt_on_save: (event, settings, data) ->
@info "Datatable has been saved"
state = @_get_state()
data['dt_filters_state'] = state['dt_filters_state']
data['dt_filters_state'] = state['dt_filters_state'] if state?


_dt_on_draw: (event, settings, json) ->
Expand All @@ -197,39 +197,35 @@ class DatatableFilter extends Extendable


_instance_present_for: (method) ->
if !@instance? and !@_get_instance()?
if !@instance?
@error "#{method}: Datatable instance is null"
return false
else
return true


_get_instance: ->
@instance.fnSettings()


_draw_instance: ->
@instance.fnDraw(@_get_instance())
@instance.draw()


_run_filter: (column_id, value) ->
@instance.fnFilter(value, column_id)
@instance.columns(column_id).search(value).draw(false)


_set_search_value: (column_id, value) ->
@_get_instance().aoPreSearchCols[column_id].sSearch = value
@instance.context[0].aoPreSearchCols[column_id].sSearch = value


_get_state: ->
@_get_instance().oLoadedState
@instance.state.loaded()


_set_state: (state) ->
@_get_instance().oLoadedState = state
@instance.context[0].oLoadedState = state


_save_state: ->
@_get_instance().oApi._fnSaveState(@_get_instance())
@instance.state.save()


export default DatatableFilter

0 comments on commit 86e87e7

Please sign in to comment.