per: http://getbootstrap.com/css/#tables

bootstrap isolates table styles, and it would be great to apply these to views tables - particularly to use more than one additional setting like:

- table striped
- table bordered
(e.g. use these together by altering settings within views using a new bootstrap table setting in views)

others that would be awesome (via settings for any bootstrap views table):
-table hover
- table condensed
-table responsive

Comments

zilla’s picture

has anybody done a table a different way in bootstrap using views? the default table option obviously works and displays, with just zero "bootstrap specific element/use"

rerooting’s picture

For Radix UI I began developing something that extended the table display plugin and exposed these options to users. I could probably dig up the code and post it as a patch, it was fairly simple.

zilla’s picture

that would be awesome - striped/bordered is quite useful, and doing it via the settings versus styling the entire custom view seems a thousand times easier and more intuitive

mrded’s picture

Title: please add support for bootstrap table » Add support for bootstrap table
Status: Active » Fixed

Table plugin has been committed to 2.x-dev & 3.x-dev branches.

Status: Fixed » Closed (fixed)

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

busla’s picture

I would really like for the maintainer to re-open the issue since table-responsive is missing.

mrded’s picture

Status: Closed (fixed) » Needs work
busla’s picture

@mrred: I looked briefly over the Views Plugins API and didn´t see a simple way to wrap the whole table in a <div></div> and add .table-responsive to the classes_array.

Perhaps, add a views plugin preproccess function and add a new varible that contains true/false and then add a condition in the template file to include the div or not?

I´m up for creating a patch but might need a tip from you so it doesn´t get messy.

Melissamcewen’s picture

An issue I've encountered is my table header is empty

<thead>
<tr>
<th class="views-field views-field-field-pic"> </th>
<th class="views-field views-field-title">
<a class="active" title="sort by " href="/mysite/books?order=title&sort=asc"></a>
</th>
</tr>
</thead>
milos.kroulik’s picture

Melissamcewen: Please open a new issue for your problem. This one is for discussing new functionality, not bug reports. Also don't forget to include export of your view, so we can replicate it.

waverate’s picture

Marked #2271557: Responsive tables as duplicate of this issue.

alcauza’s picture

Regarding the responsive table style, here you can find a patch to add this feature.
Despite I am not a fan of Bootstrap solution to provide a responsive table, I though this could be a feature to include in this module in order to mimic the Bootstrap behavior at the most.
An option called 'Responsive' is added to the views bootstrap table style.
The main change is added to the views-bootstrap-table-plugin-style.tpl.php file where a

is added to wrap the table. This div will include the ".table-responsive" needed to allow bootstrap perform the responsiveness on the table.
alcauza’s picture

Status: Needs work » Needs review
waverate’s picture

#12 looks good.

Thank you.

burnsjeremy’s picture

#12 works for now, would like to see that empty div completely removed in the future.

Question: How many does "looks good" does an issue need before it can be moved into the next phase? Just wondering, I realize this one only has two (One before me and the next).

mrded’s picture

Status: Needs review » Reviewed & tested by the community

@burnsjeremy two is enough :)

iamfredrik’s picture

#12 works, but until it gets assigned I think it's better to put the template with the wrapper div in your theme.

shaundychko’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.31 KB

#12 didn't apply so I re-rolled against version 7.x-3.1 and refactored a little to print the wrapping div only if responsive tables are selected.

waverate’s picture

#12 worked fine against 7.x-3.1+30-dev.

mrded’s picture

Status: Needs review » Closed (fixed)

Let's move 'Responsive' feature to following issue: #2271557: Responsive tables