Been trying to figure out how to create custom views styles and am having no luck. I want to be able to output the data as a table but not like the default table view.
By default it does:
Label Label Label Label
Value Value Value Value
I need it to do:
Label Value
Label Value
Label Value
etc...
Could you please at least point me in the right direction and I'll pick it up from there...
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | form2table.pdf | 6.36 KB | LEternity |
Comments
Comment #1
LEternity commentedHi!
I have a related question. I would like to get an output like this:
Label Label Label Label
Label Value Value Value Value
Label Value Value Value Value
Label Value Value Value Value
Label Value Value Value Value
Does anyone know how to do this? Any hint will be appreciated!
Comment #2
dawehnerThats only for the first request
I did only tested the revert_array_dim_2 function but this worked fine.
@LEternity
Could you please write label und value numbers like in my code, i don't know whether you want to reorder the rows
Comment #3
mstef commented@dereine: Thank you. I'm assuming I can just add that into any module. I do not want to override all views that use a table output - only a handful. Is there a way to make this a new type of table output, or a way to specify which views I want to use this with?
Thanks again
Comment #4
dawehneryou have the full view object in $vars['view'] to decide whether you want to run this code.
Comment #5
mstef commentedDid you test this? I added it (unedited) to a helper module and rechecked the views and nothing has changed..
Comment #6
dawehneras i sad i just tested the helper procedure.
Perhaps you could see whether $rows_ has the right content.
Comment #7
mstef commentedwarning: implode() [function.implode]: Bad arguments. in /var/www/sites/all/modules/views/theme/views-view-table.tpl.php on line 33.
Comment #8
dawehnerHere is a new version.
This time tested :)
Not as easy as i thought at the beginning
Comment #9
mstef commentedThank you very much...not easy at all. I appreciate it. I usually have no problem writing this stuff myself, I've just never done anything custom for views so I had no idea where to start. I'll have to look over the API to find out how to exclude this code from the views I don't want to alter.
Comment #10
dawehner@LEternity
your part is really quite easy :) but i asked you something
Comment #11
LEternity commented@dereine: Sorry it took me so long to get back to you. I really appreciate your help. Here you go:
LabelX1 LabelX2 LabelX3 LabelX4
LabelY1 Value1 Value2 Value3 Value4
LabelY2 Value5 Value6 Value7 Value8
I think the difficult part in this are the x and y axis labels...
Comment #12
dawehnermh can you post how you see a default table?
so write a before and a after version, this would be nice!
Comment #13
LEternity commentedSure, here you go:
Before
LabelX1 LabelX2 LabelX3 LabelX4
Value1 Value2 Value3 Value4
Value5 Value6 Value7 Value8
After
LabelX1 LabelX2 LabelX3 LabelX4
LabelY1 Value1 Value2 Value3 Value4
LabelY2 Value5 Value6 Value7 Value8
In other words: I would like to add labels in the second (after) version that are not present in the first (before) version. In an ideal world, the combination of LabelX1 and LabelY1 would determine what value you get for Value1.
I've attached the real world example that I would like to imitate. Please note that the grey areas are calculated values.
PS: I won't imitate its ugliness...
Comment #14
dawehnerThats possible right now.
The first row seems to be the "title" of the node. So set the header of this table column to LABELX1. The Rest is possible by default.
Comment #15
LEternity commentedI think I'll just theme the tables since every one of them is different (unfortunately) and a function might not be the best solution. It's a huge data project...
Comment #16
Anonymous (not verified) commentedSorry for the noob question but where exactly does this code get inserted? I would appreciate specifics as I am not a coder at all. Very much appreciated. =)
Comment #17
esmerel commentedGeneral close of issues over 6 months old without activity.