首页 > 其他 > 详细

layui table中记住当前页

时间:2019-10-10 13:57:05      阅读:639      评论:0      收藏:0      [点我收藏+]

一 同一页面中编辑后关闭浮窗刷新当前页

table.reload(‘list‘, {
page: {
curr: $(".layui-laypage-em").next().html()
}
, where: { name: $(‘#search-name‘).val(), type_id: search_type }
});

二 跳转页面后返回当前页

父页面中:

table.render({
elem: ‘.cardapply-table‘
, url: ‘/api/enter/Getcardapply‘
, page: {
curr: history.state != null ? history.state.page : 1
}//页面缓存值为null时页码为1 否则取缓存值
, cols: [[
{ type: ‘numbers‘, title: ‘序号‘, width: ‘10%‘ }
, { field: ‘dept_name‘, width: ‘10%‘, title: ‘所属室厅‘, align: ‘center‘, rowspan: ‘1‘ }
, { field: ‘entery_name‘, width: ‘10%‘, title: ‘进点联系单‘, align: ‘center‘, rowspan: ‘1‘ }
, { field: ‘room_number‘, width: ‘20%‘, title: ‘房号‘, align: ‘center‘, rowspan: ‘1‘ }
, { field: ‘apply_user‘, width: ‘10%‘, title: ‘申请人‘, align: ‘center‘, rowspan: ‘1‘ }
, { field: ‘apply_reason‘, width: ‘10%‘, title: ‘申请原因‘, align: ‘center‘, rowspan: ‘1‘ }
, { field: ‘apply_date‘, width: ‘10%‘, title: ‘申请日期‘, align: ‘center‘, rowspan: ‘1‘ }
, {title: ‘操作‘, width: ‘20%‘, align: ‘center‘, rowspan: ‘1‘}
]]

, where: {
user_name: $.cookie(‘realname‘),
user_id: $.cookie(‘userId‘),
module_id:‘0014005‘
}
, done: function (res, curr, count)
{
history.replaceState({ page: curr }, null, ‘#/main/enter/cardapply?page=‘ + curr); //重载页面路由
}
, id: ‘list‘
});

跳转页面中

window.history.go(-1);//操作成功后返回

注:不能直接写路由地址 否则页面缓存后消失;如果是菜单栏切换 避免出现页面缓存问题 需window.history.replaceState(null, null, null);清空缓存。

layui table中记住当前页

原文:https://www.cnblogs.com/yyjspace/p/11647419.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!