Skip Navigation

[Resolved] display view in grid / responsive

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user was using a table to do his grid view but wanted that view to have only 1 column on mobiles.

Solution:

Unfortunately this is not possible using a Table, since tables don't reflow like how responsive grids would.

The best way to resolve this is to rebuild your view using the bootstrap columns.

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by ericW-5 5 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1367839

Tell us what you are trying to do?

I would like to display a view in a grid with 3 elements per row on desktop but only 1 item per row on mobile.

here is my code, which currently displays 3 elements per row on desktop but unfortunately on mobile also.

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table width="100%" class="wpv-loop js-wpv-loop">
<wpv-loop wrap="3" pad="true">
[wpv-item index=1]
<tr>
<td class='small'>
[wpv-post-body view_template="loop-item-in-projets-page-projets"]
</td>
[wpv-item index=other]
<td class='small'>
[wpv-post-body view_template="loop-item-in-projets-page-projets"]
</td>
[wpv-item index=3]
<td class='small'>
[wpv-post-body view_template="loop-item-in-projets-page-projets"]
</td>
</tr>
[wpv-item index=pad]
<td></td>
[wpv-item index=pad-last]
<td></td>
</tr>
</wpv-loop>
</table>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

And I aslo have some css here, as - on desktop - I want the items to be 1/3 of the screen width in cases there is only 2 items to display for example. Here is my css :

@media only screen and (min-width:1280px) {
.small{
width: 32%;
}

You can see the issue here : hidden link

Thanks in advance

#1367983

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Eric,

Thank you for getting in touch.

The problem here seems to be because your theme isn't loading bootstrap.

What you need to do is to go to Toolset -> Settings then scroll to bootstrap loading and set toolset to load bootstrap 3.

This should cause your columns to reflow correctly.

Thanks,
Shane

#1368393

Hi Shane,

I changed the settings to "toolset to load bootstrap 3" but I still have 3 items per row on mobile.

Many thanks in advance for your help

Regards
Eric

#1369039

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Eric,

Ok, so it seems you are using Tables.

Unfortunately tables are not responsive for mobiles so it won't reflow. What you need to do is to use the Loop Wizard on the view to generate your content using the Bootstrap Grid layout.

This will cause your items to reflow into a single column on mobile devices.

Please let me know if this helps.

Thanks,
Shane

#1369111

My issue is resolved now. Thank you!

I did it differently finally : 1 view only visible for mobile and another one only visible for desktop.

Thanks and regards
Eric