laraver ajax分页
,设置分页容器参考laraver手册 我的设置代码如下: //设置分页容器 /app/models/ZurbPresenter.php
<?php
class ZurbPresenter extends Illuminate\Pagination\Presenter {
public function getPageLinkWrapper($url, $page, $rel = null)
{
$rel = is_null($rel) ? '' : ' rel="'.$rel.'"';
return '<li><a href=javascript:goodslist("'.$url.'");>'.$page.'</a></li>';
}
public function getDisabledTextWrapper($text)
{
return '<li class="disabled"><span>'.$text.'</span></li>';
}
public function getActivePageWrapper($text)
{
return '<li class="active"><span>'.$text.'</span></li>';
}
}
//设置分页模板 /app/view/page/page.blade.php
<ul class="pagination">
<?php echo with(new ZurbPresenter($paginator))->render(); ?>
</ul>
//设置配置文件 /app/config/view.php
<?php
return array(
'paths' => array(__DIR__.'/../views'),
//'pagination' => 'pagination::slider-3',
'pagination' => 'page.page',
);
,控制器调用的方法:代码如下 private function toAjaxTpl($templateFile='',$data='') {
$viewobj = View::make($templateFile,array('data'=>$data));
$path= $viewobj->getPath();
ob_start();
ob_implicit_flush();
include($path);
$content = ob_get_clean();
return $content;
}
public function getList(){
$reult = $this->brand->paginate();
$content = $this->toAjaxTpl('member::publish.ajaxtpl.ajaxsold',$reult);
$data = ['status'=>true,'data'=>$content];
return Response::json($data);
}
,ajax分页模板代码 <thead>
<tr>
<th>商品</th>
<th>金额</th>
<th>发布时间</th>
<th>过期时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
foreach($data as $d){
?>
<tr>
<td valign="middle">
<a href=""><img src="../images/uCenter/nail.jpg" width="" height=""/><?php echo $d->title ; ?></a> </td>
<td>9999元11</td>
<td><?php echo $d->created_at; ?></td>
<td><?php echo $d->validity_date; ?></td>
<td><i class="icon icon-eye-open tip0" data-toggle="tooltip" data-placement="top" title="查看"></i> |
<i class="icon icon-edit tip0" data-toggle="tooltip" data-placement="top" title="编辑"></i> <br /> <i class="icon icon-chevron-down tip0" data-toggle="tooltip" data-placement="top" title="下架"></i> | <i class="icon icon-remove tip0" data-toggle="tooltip" data-placement="top" title="删除"></i>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<td cols='' > <?php echo $data->links(); ?></td>
</tr>
</tfoot>
................
//js代码:
<script type="text/javascript">
var tm_classify=[];
function expire(){
var url = '{{ route("member.publish.getlist") }}';
$.getJSON(url,function(data){
console.info(data);
$('#expire').html(data.data);
});
};
function goodslist(url){
$.getJSON(url,function(data){
$('#expire').html(data.data);
});
}
</script>
laraver ajax分页的更多相关文章
- [jQuery]jQuery DataTables插件自定义Ajax分页实现
		前言 昨天在博客园的博问上帮一位园友解决了一个问题,我觉得有必要记录一下,万一有人也遇上了呢. 问题描述 园友是做前端的,产品经理要求他使用jQuery DataTables插件显示一个列表,要实现分 ... 
- ThinkPHP 整合Bootstrap Ajax分页
		ThinkPHP Ajax分页代码 publicfunction index() { $where=array(); $name = I('name'); if(!empty($name)){ $wh ... 
- yii2的分页和ajax分页
		要想使用Yii分页类第一步:在控制器层加载分页类 use yii\data\Pagination;第二步: 使用model层查询数据,并用分分页,限制每页的显示条数$data = User::find ... 
- [js开源组件开发]ajax分页组件
		ajax分页组件 我以平均每一周出一个开源的js组件为目标行动着,虽然每个组件并不是很庞大,它只完成某一个较小部分的工作,但相信,只要有付出,总会得到回报的.这个组件主要完成分页的工作. 这张图里显示 ... 
- MvcPager 概述 MvcPager 分页示例 — 标准Ajax分页  对SEO进行优化的ajax分页 (支持asp.net mvc)
		该示例演示如何使用MvcPager最基本的Ajax分页模式. 使用AjaxHelper的Pager扩展方法来实现Ajax分页,使用Ajax分页模式时,必须至少指定MvcAjaxOptions的Upda ... 
- MVC - 11(下)jquery.tmpl.js +ajax分页
		继续 mvc-11(上).dto:http://www.cnblogs.com/tangge/p/3840060.html jquery.tmpl.js 下载:http://pan.baidu.com ... 
- PHP+jQuery 长文章分页类 ( 支持 url  / ajax 分页方式 )
		/* ******* 环境:Apache2.2.8 ( 2.2.17 ) + PHP5.2.6 ( 5.3.3 ) + MySQL5.0.51b ( 5.5.8 ) + jQuery-1.8 **** ... 
- PHP+jQuery 列表分页类 ( 支持 url 分页 / ajax 分页 )
		/* ******* 环境:Apache2.2.8 ( 2.2.17 ) + PHP5.2.6 ( 5.3.3 ) + MySQL5.0.51b ( 5.5.8 ) + jQuery-1.8.3.mi ... 
- php--yii框架中的ajax分页与yii框架自带的分页
		要想使用Yii分页类 第一步:在控制器层加载分页类 use yii\data\Pagination; 第二步: 使用model层查询数据,并用分分页,限制每页的显示条数 $data = Zhao::f ... 
随机推荐
- nginx try_files命令
			location / { index index.html index.htm index.php l.php; autoindex on; try_files $uri $uri/ /index.p ... 
- Linq 中 表连接查询
			public void Test(){ var query = from a in A join b in B on A.Id equals B.Id into c from d in c.Defau ... 
- BlockingQueue详解
			本例介绍一个特殊的队列:BlockingQueue,如果BlockingQueue是空的,从BlockingQueue取东西的操作将会被阻断进入 等待状态,直到BlockingQueue进了东西才会被 ... 
- TCP,IP,HTTP,SOCKET区别和联系
			物理层-- 数据链路层-- 传输层-- TCP协议 会话层-- 我 们在传输数据时,可以只使用(传输层)TCP/IP协议,但是那样的话,如 果没有应用层,便 ... 
- cpu和内存的关系
			CPU是负责运算和处理的,内存是交换数据的.当程序或者操作者对CPU发出指令,这些指令和数据暂存在内存里,在CPU空闲时传送给CPU,CPU处理后把结果输出到输出设备上,输出设备就是显示器,打印机等. ... 
- 第17章 使用iSCSI服务部署网络存储
			章节概述: 本章节将分析SCSI与iSCSI技术结构的不同,了解iSCSI技术的优势.SAN存储网络技术结构以及iSCSI HBA卡的作用. 完整演示部署iSCSI target服务程序的方法流程:创 ... 
- sql分页查询语句
			有关分页 SQL 的资料很多,有的使用存储过程,有的使用游标.本人不喜欢使用游标,我觉得它耗资.效率低:使用存储过程是个不错的选择,因为存储过程是经过预编译的,执行效率高,也更灵活.先看看单条 SQL ... 
- 台大《机器学习基石》课程感受和总结---Part 1(转)
			期末终于过去了,看看别人的总结:http://blog.sina.com.cn/s/blog_641289eb0101dynu.html 接触机器学习也有几年了,不过仍然只是个菜鸟,当初接触的时候英文 ... 
- Binary Tree Right Side View
			Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ... 
- POJ 2418
			http://poj.org/problem?id=2418 这是一个二叉树的题目,但我看了下书,还是不是特别理解会用二叉树,所以我就用其他的办法来做,结果一样AC,时间也就1700多ms,比起二叉树 ... 
