layui table数据表格reload where参数保留问题

时间:2022-12-17 09:43:39

layui table数据表格reload where参数保留问题

在使用layui过程中多多少少会遇到些问题

table reload 有个坑:reload时where参数会保留上次的参数,如果用

done: function(res, curr, count){ this.where={};}

来处理,默认的表格分页会把第一次请求的参数去掉。两者遇到些冲突。

用下面的方式来解决:

var tableIns = table.render({
elem: '#test-table-toolbar' //绑定table表格
// ,url: '/api/mockrecord/findByRPID?rpid=100002'
,url: '/api/bug/findAllPageInfo?project_name='+project_name
,toolbar: '#test-table-toolbar-toolbarDemo'
,title: '用户数据表'
//,height:500 //不建议这样使用,建议直接返回Map
/*,parseData: function(res){ //res 即为原始返回的数据
return {
"code": 0, //解析接口状态
"msg": "hint message", //解析提示文本
"count": 10, //解析数据长度
"data": res //解析数据列表
};
}*/ /*
,request: {
pageName: 'curr' //页码的参数名称,默认:page
,limitName: 'nums' //每页数据量的参数名,默认:limit
}*/ ,cols: [[
// {type: 'checkbox', fixed: 'left'}, {field:'bug_key', title: '关键字', width: 150,fixed: 'left'} ,{field:'bug_summary', title:'概要', width:600, unresize: true/*, sort: true*/}
,{field:'bug_labels', title:'模块', width:100, sort: true}
,{field:'bug_labels', title:'类型', width:100, sort: true} ,{field:'bug_assigneedisplayname', title:'经办人', width:100, templet: function(res){
return '<em>'+ res.bug_assigneedisplayname +'</em>'
}}
,{field:'bug_reporterdisplayname', title:'报告人', width:100, templet: function(res){
return '<em>'+ res.bug_reporterdisplayname +'</em>'
}}
,{field:'bug_priority', title:'优先级', width:100, /*, sort: true*/}
,{field:'bug_status', title:'状态', width:100} ,{field:'bug_createddate', title:'创建日期',width:100,templet: '<div>{{ layui.laytpl.toDateString(d.bug_createddate) }}</div>'}
,{field:'bug_updateddate', title:'已更新',width:100,templet: '<div>{{ layui.laytpl.toDateString(d.bug_createddate) }}</div>'}
,{field:'bug_duedate', title:'到期日',width:100,templet: '<div>{{ layui.laytpl.toDateString(d.bug_createddate) }}</div>'}
,{fixed: 'right', title:'操作', toolbar: '#test-table-toolbar-barDemo', width:150}
]]
,page: true
,limit: 50
,limits: [50, 100, 150]
// ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
,jump: function(obj, first){
if(!first){
layer.msg('第 '+ obj.curr +' 页');
}
}
});

使用table的实例化对象来reload

tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
,limit:50
}
, method:'POST'
,url: '/api/bug/findAllBugsBySearchCondition'
,where: formData
,contentType: 'application/json'
//,height: 300
,done: function(res, curr, count){
//this.where={};
//不清空,有问题:搜索条件会保留
//清空, 有问题:分页的时候没有搜索条件了,分页会受到影响
}
});

layui table数据表格reload where参数保留问题的更多相关文章

  1. layui table 数据表格 隐藏列

    现在国内的模板,也就layui一家独大了,其中的数据表格功能强大,但我不会用python或者django拼接json,输出发送给数据表格,那只好用笨办法,循环遍历吧. 数据表格中保留id列,是为了编辑 ...

  2. layui table 数据表格固定列的行高和table其他列的行高不一致

    1.问题描述:使用layui的table数据表格,固定某一列,这样表格中数据的宽度超出屏幕宽度时,固定列可以一直显示在屏幕中,不会随着底部滚动栏左右的拖动而变化位置.但是遇到一个问题,就是固定列的行高 ...

  3. LayUI之table数据表格获取行、行高亮等相关操作

    前言 目前LayUI数据表格既美观有不乏一些实用功能.基本上表格应有的操作已经具备,LayUI作者[贤心]肯定是煞费苦心去优化,此处致敬.但是实话实话,如果单纯那数据表格功能来说,EasUI的数据表格 ...

  4. 项目总结17-使用layui table分页表格

    项目总结17-使用layui table分页表格总结 前言 在项目中,需要用到分页的表格来展示数据,发现layui的分页表格,是一个很好的选择:本文介绍layui table分页表格的前后端简单使用 ...

  5. layui中,同一个页面动态加载table数据表格

    效果图: 前端代码: <div class="layui-fluid" id="record-user" hidden="hidden&quot ...

  6. layui的数据表格加上操作

    数据表格加上操作. <script type="text/html" id="barDemo"> <a class="layui-b ...

  7. layui:数据表格如何合并单元格

    layui.use('table', function () { var table = layui.table; table.render({ elem: '#applyTab' , url: '$ ...

  8. layui动态数据表格-分页

    数据结构 $list = [ [,'], [,] ]; $json[; $json['; $json[; $json['data'] = $list; return json($json); 代码: ...

  9. table数据表格添加checkbox进行数据进行两个表格左右移动。

    <table class="table table-hover table-striped table-condensed newDateList"> <thea ...

随机推荐

  1. 把复杂json解析成javabean

    工具:fastjson1.2.9 用其他工具也行,比如json-lib.gson 用法都差不多 先来一段json { "page": { "pagenow": ...

  2. MYSQL建表语法(主键,外键,联合主键)

    在看<Learning SQL>第二版, 慢慢打实SQL的基础. 建表一: ), lname ), gender ENUM(), city ), state ), country ), p ...

  3. 问题-Delphi2007跟踪变量时提示&OpenCurlyDoubleQuote;E2171 Variable &&num;39&semi;APolygon&&num;39&semi; inaccessible here due to optimization”

    问题现象:Delphi2007跟踪变量时提示“E2171 Variable 'APolygon' inaccessible here due to optimization” . 问题原因:可能是因为 ...

  4. Clone table header and set as the first element&comma; and replace header&&num;39&semi;s th with td

    Clone table header and replace header's th with td var tableHeaderRow = '#tableId tbody tr:nth-child ...

  5. 5&period;3&colon;从bean的实例中获取对象

    5.3  从bean的实例中获取对象 在getBean方法中,getObjectForBeanInstance是个高频率使用的方法,无论是从缓存中获得bean还是根据不同的scope策略加载bean. ...

  6. tomcat启动

    http://jingyan.baidu.com/article/c33e3f48a42352ea15cbb5d4.html

  7. BZOJ2064&colon; 分裂

    2064: 分裂 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 360  Solved: 220[Submit][Status][Discuss] De ...

  8. Python学习日记:day9--------函数

    初识函数 1,自定义函数 s ='内容' #自定义函数 def my_len():#自定义函数没有参数 i =0 for k in s: i+=1 print(i) return i #返回值 my_ ...

  9. hdu 1394 逆序对(nlgn&plus;o&lpar;n&rpar; )

    Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s) ...

  10. Ubuntu中通过SuperVisor添加守护进程

    1. 用途 守护进程用于保持一个指定程序(dll)时刻保持运行.在命令行终端中通过dotnet run命令执行的程序,在退出命令行终端后,程序自动终止.添加守护进程后,即使终端退出,程序仍可后台执行. ...