mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Add default page size when it's not in request params when fetching projects
This commit is contained in:
parent
2794f75215
commit
c8d170f9ec
1 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,11 @@ class ProjectsOverviewService
|
||||||
|
|
||||||
def projects_datatable
|
def projects_datatable
|
||||||
table_state = @view_state.state.dig('projects', 'table')
|
table_state = @view_state.state.dig('projects', 'table')
|
||||||
per_page = @params[:length] == '-1' ? 10 : @params[:length].to_i
|
per_page = if @params[:length] && @params[:length] != '-1'
|
||||||
|
@params[:length].to_i
|
||||||
|
else
|
||||||
|
10
|
||||||
|
end
|
||||||
table_state['length'] = per_page if table_state['length'] != per_page
|
table_state['length'] = per_page if table_state['length'] != per_page
|
||||||
page = @params[:start] ? (@params[:start].to_i / per_page) + 1 : 1
|
page = @params[:start] ? (@params[:start].to_i / per_page) + 1 : 1
|
||||||
records = fetch_dt_records
|
records = fetch_dt_records
|
||||||
|
|
Loading…
Reference in a new issue