wice_grid
wice_grid copied to clipboard
Parameter total_entries doesnt work?
Hi,
Is parameter :total_entries
for initialize_grid
just blind parameter?
I see in code that you uses do_count method to count entries, which is alias for AR count method.
Is there any way how to override internal counting ? We use complex aggregated functions in SQL query and count
method just wraps our sql code and it doest work anymore. We must use length
method to count result.
Is there any solution how to override couting?
Regards!
:total_entries
should be deleted, thank you for noticing this. It's a legacy option. Internal counting is not performed by count
or do_count
. It is Kaminari which does that
Understand,
maybe it is interesting to pass-in initialize_grid
some Kaminari parameters. For example Kaminari has possibility to change count with :total_count
parameter. Rails AR are not much smart when joins
or group
using native SQL commands instead symbols as association names.
For example we use SQL table view, it is much faster than multiple includes
. This also with some aggregate functions in scopes and AR collapses because it doesnt know how to use COUNT properly on that query.
What do you think?
Well, I have nothing against an option which, if present, would be submitted to Kaminari as total_count
. It's actually a very easy thing to implement. If you submit a PR I will merge it.