thank you a lot it's working !!!
Le mardi 13 août 2019 16:39:28 UTC+2, Sergio Cambra a écrit :
>
> El lunes, 12 de agosto de 2019 22:57:20 (CEST) Gloufy escribió:
> > Hi,
> >
> > It’s possible to get a json from a list and paginate like when i get it
> in
> > html page=1 etc? Thank you for your help
> >
> > Gloufy
>
> Hi
>
> It's not possible by default, but you can override find_page_options in
> your
> controller.
>
> def find_page_options
> options = {
> :sorting => active_scaffold_config.list.user.sorting,
> :count_includes => active_scaffold_config.list.user.count_includes
> }
>
> paginate = params[:format].nil? ? accepts?(:html, :js) : %w[html
> js].include?(params[:format])
> options[:pagination] = active_scaffold_config.list.pagination if
> paginate
> if options[:pagination]
> options[:per_page] = active_scaffold_config.list.user.per_page
> options[:page] = active_scaffold_config.list.user.page
> end
>
> if active_scaffold_config.list.auto_select_columns
> auto_select_columns = list_columns +
> [active_scaffold_config.columns[active_scaffold_config.model.primary_key]]
> options[:select] = auto_select_columns.map { |c|
> quoted_select_columns(c.select_columns) }.compact.flatten
> end
>
> options
> end
>
> This line is disabling paginate for other formats than html or js:
>
> paginate = params[:format].nil? ? accepts?(:html, :js) : %w[html
> js].include?
> (params[:format])
>
> You can call super and add lines below that line:
>
> def find_page_options
> options = super
>
> unless options[:pagination]
> options[:pagination] = active_scaffold_config.list.pagination
> if options[:pagination]
> options[:per_page] = active_scaffold_config.list.user.per_page
> options[:page] = active_scaffold_config.list.user.page
> end
> end
>
> options
> end
>
> I have been thinking for a while in changing this, and add a config
> option, so
> pagination can be optionally enabled for other formats than html and js.
>
> Regards,
> Sergio
>
>
>
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/activescaffold/da454f19-28b9-4aed-a48a-de4c060fb8c6%40googlegroups.com.