Comments (7)
For consistency, you might consider moving away from the format_first_name
style and making a format_column
that mirrors format_header
. For example, the user could do:
def format_column(column_name, value)
case column_name.to_sym
when :month, :location then value.capitalize
when :weaksauce_secret then Base64.encode64(value)
else formatter.number_to_currency(value)
end
end
from dossier.
In some reports I've been moving the other way and doing a first_name_header
method and using format_header
as a dispatcher.
from dossier.
Though it would be nice to do
def format_column(name, value)
case name.to_sym
when :amount, :tax, :subtotal
formatter.number_to_currency(value)
else
value
end
end
One important thing to remember is that a default formatter like this would need to always return a value...
from dossier.
One important thing to remember is that a default formatter like this would need to always return a value...
True. It would be helpful to raise an exception if it didn't.
from dossier.
The problem with that, is that sometimes you might not want it to return a value intentionally.
Sent from my iPhone
On Jun 14, 2013, at 1:48 PM, Nathan Long [email protected] wrote:
One important thing to remember is that a default formatter like this would need to always return a value...
True. It would be helpful to raise an exception if it didn't.
—
Reply to this email directly or view it on GitHub.
from dossier.
Because you want the column to be blank? In that case, you could return an empty string; the exception would be raised if you returned nil.
from dossier.
Good point, returning nil
should raise an exception.
from dossier.
Related Issues (20)
- Pagination question HOT 3
- Connection not working on production
- Question: Is there a correct way to add a total or summary row? HOT 2
- How to specify which view to use? HOT 1
- Grouped information HOT 4
- Rails 4.2 ActionController::Responder Integration HOT 2
- Can you namespace the default dossier route? HOT 3
- How can I select a database column without displaying it as its own report column? HOT 3
- Question: Is it possible to pass my own arguments into the constructor for a report? HOT 4
- What commands are needed to get this up and running?
- Return more than one query to report HOT 2
- Passing options to Report from Controller HOT 1
- CSV Report Formatting HOT 1
- MultiTenant App with Dossier
- crosstab example
- Derived data columns
- HAML dependency HOT 1
- CSV not working on some reports HOT 1
- JSON/CSV issues with display_column?
- Does not work with Rails 6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dossier.