Replies: 19 comments
-
If we make some assumptions about what kind of data will be available in a table footer, the DSL could be simplified drastically. For your example: column :balance, sum: true We could also offer mean/median/etc. |
Beta Was this translation helpful? Give feedback.
-
👍 I like the idea and will think about it |
Beta Was this translation helpful? Give feedback.
-
@ccallebs your idea is not bad, but it's not generic. We need to map each kind of SQL Function to a attribute. column :balance, footer: "SUM(balance)" |
Beta Was this translation helpful? Give feedback.
-
@timoschilling , |
Beta Was this translation helpful? Give feedback.
-
@Fivell sure, that was only 'equal' to |
Beta Was this translation helpful? Give feedback.
-
👍 hope we'll add this feature soon |
Beta Was this translation helpful? Give feedback.
-
To make it possible to use formatting in the footer I suggest adding the |
Beta Was this translation helpful? Give feedback.
-
after few modifications, I fix problem with multiple queries, now I use it like index footer_data: ->(collection){collection.except(:includes, :limit, :offset).reorder("").select("sum(amount) as total_amount").to_a.first} do
id_column
column :amount, footer: -> {
@footer_data[:total_amount]
}
column :account
column :notes
column :created_at
end |
Beta Was this translation helpful? Give feedback.
-
I don't like the API with so many This should work: column :amount, footer: &:total_amount |
Beta Was this translation helpful? Give feedback.
-
@timoschilling , this doesn't work
|
Beta Was this translation helpful? Give feedback.
-
I don't like DSL with many procs too, so maybe we might think about other way footer ->(collection) {collection.totals }, as: :table do
column :total, for: :amount do |row|
number_to_currency(row.total)
end
end then we need
so DSL args |
Beta Was this translation helpful? Give feedback.
-
Hello @timoschilling . Is there any progress (plan) related to this issue? |
Beta Was this translation helpful? Give feedback.
-
@fwebs no |
Beta Was this translation helpful? Give feedback.
-
Other way to customize collection and add mock object for footer row like:
|
Beta Was this translation helpful? Give feedback.
-
Hi Authors, commentors, |
Beta Was this translation helpful? Give feedback.
-
@pundit maybe, all depends on whether someone the time it takes to build |
Beta Was this translation helpful? Give feedback.
-
@timoschilling, this is a very good idea, whats the problem with original solution? ugly dsl is better than no dsl at all. And a footer_proc is not ugly for me, it permits calculate custom things like "Weighted Average" and so one. |
Beta Was this translation helpful? Give feedback.
-
any progress on this? |
Beta Was this translation helpful? Give feedback.
-
Any progress on this? |
Beta Was this translation helpful? Give feedback.
-
Hello @timoschilling , @seanlinsley , Hello contributors.
One of my customer asked me to display total sum for some of columns in table footer crossing all the pages. I looked at source code and found out there was nothing in AA working out of the box for implementing such I small feature.
So I patched some classes and forgot about it. But now I need to do it again in another project.
![footer](https://cloud.githubusercontent.com/assets/120269/6202667/93e4c2ec-b500-11e4-8a29-bb5ab132db8c.png)
Screenshot to clarify
How this was done.
and
table_for``source -> https://gist.github.com/Fivell/d45653841cee22a890f5
Problems with such hack
sum
oravg
ormax
of each of them), the much more better way is to calculate aggregations for each of column with 1 sql queryAny ideas how to improve this and make it part of AA?
Beta Was this translation helpful? Give feedback.
All reactions