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

dereine - April 11, 2009 - 07:10

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

merlinofchaos - April 11, 2009 - 17:45

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

dereine - April 11, 2009 - 18:08

there is a patch but i cannot find the patch anymore :(
The patch added a option to every field

#4

dereine - April 13, 2009 - 07:52

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.

AttachmentSize
views-field-empty.patch 1.75 KB

#5

dereine - April 13, 2009 - 07:54
Status:active» needs review

needs review...

#6

dereine - April 15, 2009 - 16:07
Version:6.x-2.3» 6.x-2.x-dev

move this to dev

#7

dereine - April 22, 2009 - 17:16
Status:needs review» needs work

move it to work, its horrible, there should be somehing in preprocess function if i understood/remember merlin correct

#8

design.er - April 28, 2009 - 09:30

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

design.er - May 12, 2009 - 13:34

Any news?

#10

phillipadsmith - May 29, 2009 - 19:42

Subscribing.

#11

valderama - November 6, 2009 - 10:13

subscribing

#12

Deg - November 10, 2009 - 20:30

Subscribing

#13

merlinofchaos - November 11, 2009 - 01:49
Status:needs work» fixed

Views 2.6 introduced a feature like this.

#14

valderama - November 13, 2009 - 10:38

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

merlinofchaos - November 13, 2009 - 19:09

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

valderama - November 17, 2009 - 15:59

this was introduced in views 2.7 !! not in views 2.6.

therefor i could not find it.

#17

merlinofchaos - November 18, 2009 - 05:17

D'oh! You are right about that. Sorry! Yes, in 2.7. I guess I can't read my own release notes. =)

#18

System Message - December 2, 2009 - 05:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.