HubDB - First row, last column result is not showing up

SOLVE
Highlighted
Top Contributor

Hello,

 

The results of my HubDB table are not showing up quite right. For some reason the first row, last column is missing for all searched results. Example - if there are 7 results w/ 4 results per row, the 1st row will show 3 results and the 2nd row will show 4 results. The top row, last column is left blank.

 

Here is a link to the page this is happening on...

http://www.alignex.com/training-classes

 

Anyone know why this is happening? Any help would be greatly appreciated!

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Top Contributor

UPDATE: Figured out what the error was... there was an extra <div> tag around the filter by drop down code that was making that happen. 

Reply
0 Upvotes
4 Replies 4
Highlighted
Occasional Contributor

Hi @leckerman,



Would you be able to post here the part of your code where you show the results or do the loop from hubDB? It will be easier to help you that way.

Reply
0 Upvotes
Highlighted
Top Contributor

Below is the code for the custom module on this page - https://www.alignex.com/training-classes. Is it possible its something in the .css doc that would be the problem? Thank you so much for taking a look. I am stumped. 

 

{# Load Card Stylesheet #}
{{ require_css(Custom/page/css/resource-card.css) }}

<!-- set the filter by drop down, search bar, and submit button -->
<div>
<form id="form_id" method="get">
<div>
<div class="filter span6">
<h4>FILTER BY LOCATION:</h4>
<select name="location" form="form_id" onChange="this.form.submit()">
<option **bleep**="show-all">Show All</option>
{% set types = hubdb_table_column(674971, "location").options %}
{% for choice in types %}
{% set location_list = location_list~choice.id|list%}
{% if choice.id == request.query_dict.location%}
<option selected="selected" **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="filter span6">
<h4>FILTER BY TYPE OF COURSE:</h4>
<select name="type" form="form_id" onChange="this.form.submit()">
<option **bleep**="show-all">Show All</option>
{% set types = hubdb_table_column(674971, "type").options %}
{% for choice in types %}
{% set type_list = type_list~choice.id|list%}
{% if choice.id == request.query_dict.type%}
<option selected="selected" **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
</form>
</div>
<br>

<!-- sets the different query parameters using submitted input for hubdb query -->
{% set locationquery = "&orderBy=-name" %}
{% if request.query_dict.location in ["1", "2", "3", "4", "5", "6"] %}
{% set locationquery = locationquery ~ "&location="~request.query_dict.location|urlencode %}
{% endif %}
{% if request.query_dict.location == "show-all" %}
{% set locationquery = locationquery %}
{% endif %}
{% set typequery = "" %}
{% if request.query_dict.type in ["1", "2", "3", "4", "5", "6"] %}
{% set typequery = typequery ~ "&type="~request.query_dict.type|urlencode %}
{% endif %}
{% if request.query_dict.type == "show-all" %}
{% set typequery = typequery %}
{% endif %}

{# Get Resource from HubDB #}
{% set table = hubdb_table_rows(674971, typequery + locationquery)%}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}
{% for row in table %}
<div class="resource-card-container {{ widget.cards_in_row }}">
<div class="resource-card">
<div class="image-container">
<a href="{{ row["course_url"] }}"><img src="{{ row.course_image }}" width="500" {% if row.image.width > row.image.height %}class="landscape"{% endif %} alt="{{ row.name }} Image"></a>
</div>
<div class="resource-info">
<h3>{{ row.course_name }}</h3>
<div class="resource-description">
<p><strong>Location:</strong> {{ row.class_location }}</p>
<p><strong>Length:</strong> {{ row.length }} Days</p>
<p><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p><br>
<p>{{ row.description }}</p>
<div class="row-fluid ">
<div class="span6"><h5>{{ row.hs_name }}</h5></div>
<div class="span6"><span class="btn"><a href="{{ row["course_url"] }}">Details</a></span></div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}

 

Reply
0 Upvotes
Highlighted
Top Contributor

UPDATE: Figured out what the error was... there was an extra <div> tag around the filter by drop down code that was making that happen. 

Reply
0 Upvotes
Highlighted
Top Contributor

Here is the custom module code below that is shown on this page - https://www.alignex.com/training-classes. Is it possible its something in the .css doc that is the issue? Thank you so much for taking a look. I am stumped.

 

{# Load Card Stylesheet #}
{{ require_css(Custom/page/css/resource-card.css) }}

<!-- set the filter by drop down, search bar, and submit button -->
<div>
<form id="form_id" method="get">
<div>
<div class="filter span6">
<h4>FILTER BY LOCATION:</h4>
<select name="location" form="form_id" onChange="this.form.submit()">
<option **bleep**="show-all">Show All</option>
{% set types = hubdb_table_column(674971, "location").options %}
{% for choice in types %}
{% set location_list = location_list~choice.id|list%}
{% if choice.id == request.query_dict.location%}
<option selected="selected" **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="filter span6">
<h4>FILTER BY TYPE OF COURSE:</h4>
<select name="type" form="form_id" onChange="this.form.submit()">
<option **bleep**="show-all">Show All</option>
{% set types = hubdb_table_column(674971, "type").options %}
{% for choice in types %}
{% set type_list = type_list~choice.id|list%}
{% if choice.id == request.query_dict.type%}
<option selected="selected" **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option **bleep**="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
</form>
</div>
<br>

<!-- sets the different query parameters using submitted input for hubdb query -->
{% set locationquery = "&orderBy=-name" %}
{% if request.query_dict.location in ["1", "2", "3", "4", "5", "6"] %}
{% set locationquery = locationquery ~ "&location="~request.query_dict.location|urlencode %}
{% endif %}
{% if request.query_dict.location == "show-all" %}
{% set locationquery = locationquery %}
{% endif %}
{% set typequery = "" %}
{% if request.query_dict.type in ["1", "2", "3", "4", "5", "6"] %}
{% set typequery = typequery ~ "&type="~request.query_dict.type|urlencode %}
{% endif %}
{% if request.query_dict.type == "show-all" %}
{% set typequery = typequery %}
{% endif %}

{# Get Resource from HubDB #}
{% set table = hubdb_table_rows(674971, typequery + locationquery)%}

{% if table == [] %}
<p class='align-center'>Sorry, no listings found for that Search. Try changing your fiter and search again.</p>
{% else %}
{% for row in table %}
<div class="resource-card-container {{ widget.cards_in_row }}">
<div class="resource-card">
<div class="image-container">
<a href="{{ row["course_url"] }}"><img src="{{ row.course_image }}" width="500" {% if row.image.width > row.image.height %}class="landscape"{% endif %} alt="{{ row.name }} Image"></a>
</div>
<div class="resource-info">
<h3>{{ row.course_name }}</h3>
<div class="resource-description">
<p><strong>Location:</strong> {{ row.class_location }}</p>
<p><strong>Length:</strong> {{ row.length }} Days</p>
<p><strong>Date:</strong> {{row.date|datetimeformat('%A, %B %e, %Y') }}</p><br>
<p>{{ row.description }}</p>
<div class="row-fluid ">
<div class="span6"><h5>{{ row.hs_name }}</h5></div>
<div class="span6"><span class="btn"><a href="{{ row["course_url"] }}">Details</a></span></div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}

Reply
0 Upvotes