[英]Adding Pagination after Ajax call in Joomla
我在joomla 3.4中有一个模块,可为某些产品创建一个jquery价格范围滑块。 它使用ajax加载结果,但不会加载分页,因此,如果有40个以上的结果(我的分页限制),则仅显示前40个结果,而没有分页时无法查看其余内容。 如果有一个,如何显示分页? 分页必须正常而不是ajax。
这是模块的代码
<?php
//some code here to calculate $min and $max values of price range
//some code here to add component parameters in the $url variable
//below the final part of the $url variable, as you can see it has tmpl=component which prevents the pagination from being loaded. If I remove the tmpl=component part then I get an internal server error 500
$url .='&format=raw&ajax=1&tmpl=component';
?>
<script>
jQuery(function() {
jQuery( "#slider-range" ).slider({
range: true,
min: <?php echo $min;?>,
max: <?php echo $max;?>,
values: [ <?php echo $min;?>,<?php echo $max;?> ],
slide: function( event, ui ) {
jQuery( "#slider-text" ).text( "From " + ui.values[ 0 ] + " to " + ui.values[ 1 ] +' Euro');
},
stop: function( event, ui ) {
url='<?php echo $url?>'+'&min='+ui.values[ 0 ]+'&max='+ui.values[ 1 ];
jQuery('#com_datafeeds').prepend('<img style="display: block; margin:auto" src="<?php echo JURI::base(); ? >/components/com_datafeeds/assets/images/ajax-loader.gif" />');
jQuery.get(url, function(data) {
if( data) {jQuery('#com_datafeeds').html( data);
} else {
jQuery('#com_datafeeds').html('<h2>No product found for this price range</h2>');
}
});
}
});
jQuery( "#amount" ).val( "van " + jQuery( "#slider-range" ).slider( "values", 0 ) +
" tot " + jQuery( "#slider-range" ).slider( "values", 1 ) + ' Euro');
});
</script>
<div style="width:50%;margin:0px auto" id="slider-text"><?php echo "From $min to $max Euro";?></div>
<div style="width:50%;margin:0px auto" id="slider-range"></div>
您可以使用Bootstrap Datatable进行分页搜索和显示限制的最佳解决方案之一,快去试试吧! https://datatables.net/examples/styling/bootstrap.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.