Dynamic Pages Number Pagination in HubDB (Listing)
**// Filter (Show only Upcoming Event Posts) with Sorting (By Event Date)**
{% if dynamic_page_hubdb_table_id %}
{% endif %}
**// Active Pagination JS**
$(".post-pagination a").filter(function(){
return this.href == location.href.replace(/#.*/, "");
}).siblings().removeClass("active");
$(".post-pagination a").filter(function(){
return this.href == location.href.replace(/#.*/, "");
}).addClass("active");
**// 0 before pagination under 10 Paginations count**
$('.events-group-wrapper .pager li>a').each(function(){
var eachVal = parseInt($(this).text());
if( eachVal < 10){
$(this).text("0"+$(this).text());
}
});
**// Events Tabber JS**
$('.nav-tabs > li > a').click(function(){
$('html, body').stop();
var checkID = $(this).attr('data-id');
$(this).parent('li').addClass('active').siblings('li').removeClass('active');
$(this).parents('.nav-tabs').next('.tab-content').children('.tab-pane').each(function(){
var checkID1 = $(this).attr('data-id');
if( checkID == checkID1){
$(this).addClass('active').siblings().removeClass('active');
}
});
});
{% set batch_num = 6 %}
{% if not request.query_dict.page %}
{% set page_num = 1 %}
{% set offset_num = 0 %}
{% elif request.query_dict.page %}
{% set page_num = request.query_dict.page %}
{% set offset_num = page_num|add(-1) * batch_num %}
{% endif %}
{% set current_dt = unixtimestamp(local_dt) %}
{% set query = "event_date__gte="~current_dt~"&orderBy=event_date&limit=" ~ batch_num ~ "&offset=" ~ offset_num %}
{% set eventsList = hubdb_table_rows(dynamic_page_hubdb_table_id, query) %}
{% for item in eventsList %}
{% if (item['event_date']|datetimeformat('%Y-%m-%d')) > (local_dt|datetimeformat('%Y-%m-%d')) %}
{% if item.featured_image.url %}
{% endif %}
{% endif %}
{% endfor %}
{% if eventsList %}
{% endif %}
{% if item.event_date %}
{% endif %}
{% if item.hs_name %}
Comments
Post a Comment