Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
5.x-1.6
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2008 at 15:45 UTC
Updated:
15 Mar 2010 at 18:00 UTC
Is there a way to 'flip' views so the nodes are in the columns and the fields are in the rows? It'd be useful for comparing a few nodes side-by-side
Comments
Comment #1
nevets commentedYou could do this with a table view and by theming the view "flip" the default presentation of the information.
Comment #2
merlinofchaos commentedThere is no way to do this in the UI, but as nevets says, you can theme the view and restructure the output as you like. This is a fairly complex task as it uses tables and in Views 1 tables are kind of a pain to theme, but it is possible.
Comment #3
mdowsett commentedIt sounds like a pain...but I'm willing to try.
Can you give some example code?
This kind of thing would sure help with things like product comparison charts.
Comment #4
nevets commentedOk, make a table view, make sure it works. Then add the following function in your themes template.php file. You will need to replace VIEWNAME with your views name.
Comment #5
mdowsett commentedamazing! it worked!
I don't think I've ever had a question answered so well and quickly with it working. And I'm no coder by any means but I did it! (I'm proud).
Fantastic work nevets
Comment #6
merlinofchaos commentedJust popping in to say "thank you" to nevets for helping out! It's appreciated!
Comment #7
mdowsett commentedI'd like to suggest this get's worked into Views some how...it'd be nice to have an option in the views creation to "flip" it.
What d'ya think?!
Comment #8
sunCan someone add this to the handbooks, please?
Comment #9
mbeenon commentedHmm, tried this code, didnt work. using drupal 6 and views 2
Comment #10
merlinofchaos commentedThat's why.
Comment #11
mbeenon commentedSo then the code must be different! Tell me!
Comment #12
mbeenon commentedplease and thankyou.
Comment #13
faunapolis commentedSubscribing, interested in this too.
Comment #14
mdowsett commentedI thought there was a module to do this in D6....? Or even built-in to Views2...? I could be wrong...
Comment #15
pepeelfrances commentedI'm interesting too. There is also this http://drupal.org/node/174578#comment-819915 but it's for Drupal 5.X.
Someone know so how to flip columns and rows with drupal 6.x and with Wiews2 ?
Thanks :)
Comment #16
mjlF95 commentedI'm trying to do this with a view created with the editablefields module http://drupal.org/project/editablefields using the view type "Editablefields - table- no form". I got the function posted in this thread to work properly on a regular table view. I also got it to apply to the editablefield table view by changing the function name to:
function phptemplate_views_editablefields_view_table_noform_VIEWNAME($view, $nodes, $type) {I can see that it's worked properly on the first two rows but all of the editable fields do not display. I assume that it's because it's a different function that's being overwritten than what the flip-column/row code was originally written for.
I think this is the function from the editablefields module:
Is there anyone who could re-write this flip-column/row code to apply to views of this type?
Comment #17
mdowsett commentednow that I've upgraded that site I originally asked for this for to D6, I need a fix for this flip for D6....any ideas?
Comment #18
danieldd commentedSubscribing. Also very interested in a Views2/ Drupal 6 solution. Doesn't appear that http://drupal.org/node/174578 applies to Views 2.
In my case the main use would be for charts. None of existing Drupal chart modules provide functionality for flipping columns/ rows.
Comment #19
mdowsett commentedThis may be a solution...I'm trying to figure out how to name the tpl file properly to make it work.
http://drupal.org/node/174578
Comment #20
mdowsett commentedwere you ever able to do this (view flipping) with Drupal6?
Comment #21
nevets commentedI have not tried the module but people following this thread might find Views Crosstab useful
Comment #22
mdowsett commentedI tried Views Crosstab but couldn't get it to do what I wanted it to. But then again, I don't want to add anything up, just view the same data as the table view. I think the Crosstab module is for stuff very different.
Comment #23
esmerel commentedOriginal issue resolved with themeing/editable fields. If this is also a 2.x issue, a separate issue should be logged and referred back to this one as appropriate.