0

I created a view using "Table" as its format already. When I click on the title column record it shows the fields one by one.

Can I display the data of a view as table format?

  • Have you tried to play with display options? Table is there... – Mołot Feb 23 '15 at 21:38
2

yes there us absolutely a way

  1. go to any view->FORMAT->Format (unformated list) click on that see below for imageenter image description here

  2. click on table format ->apply display

and enable label in all fields. will display it in table format enter image description here

  • I got the View in Table format already. My question is, when i click on the title column record that shows fields one by one. i want to display it as table format – Sam1604 Feb 16 '15 at 13:11
1

The DataTables module might help to further enhance the prior answers to this question. Here is a quote from its project page:

The DataTables module integrates the jQuery plugin DataTables into Drupal as a views style and a callable theme function. DataTables lets you add dynamic features to tables, including:

  • Variable length pagination
  • On-the-fly filtering
  • Sorting with data type detection
  • Smart handling of column widths
  • Themeable by CSS
  • And more ...

Another feature that it offers is that you can "hide" specific columns from the default table display. But still the user has the option to do things like:

  • expand the hidden columns.
  • use the DataTables search feature to search for rows containing one or more strings contained in ... even those hidden columns.

So you could use an approach to only show, by default, a subset of all the columns, and leave it to the user to yes/no also display the (initially hidden) columns.

A few more links you may want to look at:

Refer to the (short) video about Create Powerful Tables with the DataTables jQuery Plugin and Views for an intro about it, and how to use it as a views style plugin. Using the "settings" link for this views style, you can specify all sorts of dataTables options/features. In the above video starting from around 3:00 you see many of them.

Example

Below is a screenprint of such display using DataTables. It's a display created using Views (of course) with a table with:

  • 8 fields in (defined in my view).
  • 5 table columns for the 5 fields I have decided to always show.
  • 3 table columns which I defined as "hidden and expandable" (within the DataTables settings after you select DataTables as the Views style).

Here is how the DataTables display looks like:

enter image description here

For each row there is a link 'Show Details' (in its 1st column). If you click on one (or more) of them, the hidden fields of such row are shown below that row (with grey background here) and the link you clicked changes to 'Hide Details'. Obviously, I've not done any styling for such expanded row (hence the grey background, etc). But you can see the 3 fields that were initially hidden.

Bonus: assume none of the rows are shown expanded, and you type "Basic" in the DataTables search box. It will then dynamically (in the browser, no server calls) reduce the table display to only those rows with Basic Page as value for "Type". But wait, there is even more: if you'd type a string like part of "21:15" instead (hidden in some of the rows), it will also dynamically reduce the table display to only those rows, like the expanded row shown in the screenprint. But wait, there is even (quite) a bit more: a search string like "basic 21:15" will filter the rows to a combination of both search strings. For only this one feature I often recommend the amazing DataTables module, one of Drupal's hidden gems I think. And then there are the other features like pager, sortable columns, etc.

Remarks

  • Make sure to use the 1.9.x version of the DataTables library (not 1.10.x or above), as mentioned also on the project page, which states:

    While there is work in the 7.x-2.x branch to upgrade to the latest DataTables version (1.10.x), the 7.x-1.x branch only works with DataTables <= 1.9.x. Since it's not listed in the projects download page, you will have to download it directly.

  • When creating a view, disable the pager of your view, since DataTables provides its own paging features (the video talks about that starting from 2:05).

0

In the Views interface, in "Format", you can select the "Table" format, instead of the default "Unformatted list".

See more about View formats.

  • i am asking about a record. When i click the record title it shows one by one. – Sam1604 Feb 16 '15 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.