mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 03:36:44 +08:00
Filtering and sorting of records didn't work when sorting on custom columns in repository datatable. [SCI-1357]
This commit is contained in:
parent
1f0eeeaecb
commit
6b284d8c89
1 changed files with 4 additions and 6 deletions
|
@ -179,12 +179,10 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
|
||||||
def fetch_records
|
def fetch_records
|
||||||
records = get_raw_records
|
records = get_raw_records
|
||||||
records = @assigned_rows if @my_module && params[:assigned] == 'assigned'
|
records = @assigned_rows if @my_module && params[:assigned] == 'assigned'
|
||||||
records = filter_records(records) if params[:search].present? &&
|
records = filter_records(records) if params[:search].present?
|
||||||
!sorting_by_custom_column
|
|
||||||
records = sort_records(records) if params[:order].present?
|
records = sort_records(records) if params[:order].present?
|
||||||
records = paginate_records(records) if !(params[:length].present? &&
|
records = paginate_records(records) unless params[:length].present? &&
|
||||||
params[:length] == '-1') &&
|
params[:length] == '-1'
|
||||||
!sorting_by_custom_column
|
|
||||||
escape_special_chars
|
escape_special_chars
|
||||||
records
|
records
|
||||||
end
|
end
|
||||||
|
@ -192,7 +190,7 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
|
||||||
# Overriden to make it work for custom columns, because they are polymorphic
|
# Overriden to make it work for custom columns, because they are polymorphic
|
||||||
# NOTE: Function assumes the provided records/rows are only from the current
|
# NOTE: Function assumes the provided records/rows are only from the current
|
||||||
# repository!
|
# repository!
|
||||||
def simple_search(repo_rows)
|
def filter_records(repo_rows)
|
||||||
return repo_rows unless params[:search].present? &&
|
return repo_rows unless params[:search].present? &&
|
||||||
params[:search][:value].present?
|
params[:search][:value].present?
|
||||||
search_val = params[:search][:value]
|
search_val = params[:search][:value]
|
||||||
|
|
Loading…
Reference in a new issue