Default column value
theabacus - March 23, 2009 - 18:52
| Project: | Views |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
What do you think about adding the ability to specify a default value for a column?
Basically, if a column value in a row is empty, it would display default text (i.e. "Empty"). I am willing to write the patch to update the views handlers, just wanted to get some thoughts on the idea first.

#1
there are definitve some use cases, but you have to write it different for each kind of string,
there could be empty, 0, etc.
this has to be implemented in views_handler_field.inc and be overwritten in other filters
#2
I would be open to a patch that does this, as it is a common use case and right now can only be accomplished via theming.
#3
there is a patch but i cannot find the patch anymore :(
The patch added a option to every field
#4
i think i was wrong, i searched the issue queue, but couldn't find it.
here is a first patch, which alters the ->render function.
The problem with this is that, every ->render function has to be altered, there should be a better way to do it.
#5
needs review...
#6
move this to dev
#7
move it to work, its horrible, there should be somehing in preprocess function if i understood/remember merlin correct
#8
Subscribe. I've posted this issue: #401154: How to check if a view field is empty?
I'd like to help testing and hope we'll get a working version soon.
Regards,
Stefan
#9
Any news?
#10
Subscribing.
#11
subscribing
#12
Subscribing
#13
Views 2.6 introduced a feature like this.
#14
thx merlin!
it would help if you give a hint, where to find this feature. obviously some of us don't find it.
if i see it correctly, the style plugin inserts a zero for empty values? meaning that each style-plugin would need to define how empty values are handled? or am i completely wrong?
best regards,
walter
#15
There's an option on every field for what to show if the field is empty, and a checkbox for whether or not to consider the numeric value of 0 as empty.
#16
this was introduced in views 2.7 !! not in views 2.6.
therefor i could not find it.
#17
D'oh! You are right about that. Sorry! Yes, in 2.7. I guess I can't read my own release notes. =)
#18
Automatically closed -- issue fixed for 2 weeks with no activity.