layui table中使用checkbox
第一步:
1.
<div class="layui-form">
<table class="layui-hide" lay-filter="js_table_reource_invite_supplier_index_table" id="js_table_reource_invite_supplier_index_table"></table>
</div>
2.渲染表格
table.render({
            elem: '#js_table_reource_invite_supplier_index_table',
            data:[],
            cellMinWidth: 80,
            maxHeight:300,
            loading: true,
            even: true,
            method: 'POST',
            cols: [
                [
                    {type: 'numbers', title: '序号'},
                    {type: 'checkbox', width: 50},
                    {field: 'provider_name', title: '供方名称',width: 150},
                    {field: 'is_qualified', title: '是否合格',width: 100, align: 'center',templet:function(row){
                        var html = "<input type='checkbox' lay-skin='primary' lay-filter='checkboxIsSelected' table-index='"+row.LAY_TABLE_INDEX+"' class='checkboxIsSelected' value='1' ";
                        if(row.is_qualified == 1){
                            html += " checked ";
                        }
                        html += ">";
                        return html;
                    }},
                    {
                        field:'remark', title: '综合评语', align: 'center',edit: 'text'
                    }
                ]],
                done: function (obj) {
                    layer.closeAll();
                    form.on('checkbox(checkboxIsSelected)', function(data){
                        var _index = $(data.elem).attr('table-index')||0;
                          if(data.elem.checked){
                           obj.data[_index].is_qualified = data.value;
                        }else{
                           obj.data[_index].is_qualified = 2;
                        }
                    });   
                }
        });
第二步,获取表格中的数据
var supplierList = table.cache.js_table_reource_invite_supplier_index_table;
layui table中使用checkbox的更多相关文章
- layui table中固定表头,弹框缩放之后,表头对不齐问题
		新手一枚 直接上解决方案 在layui弹出成功后再渲染表格数据 具体操作就是在layer弹层完成之后的回调中渲染表格数据 layer.open({ type: 1, content: $(&quo ... 
- JQuery 遍历table中的checkbox 并对行数据进行校验
		JQuery中confirm的使用 $(document).ready(function () { $("#Btn_Print").click(function () { var ... 
- Jquery 控制table中的checkbox 相关选中事件
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ... 
- layui table 中固定列的行高和table行高不一致
		解决方法:只需在done回调函数执行以下方法 done: function(res, curr, count){ $(".layui-table-main tr").each(fu ... 
- layui.table前端+后台处理+分页
		前端 注:监听工具条没有详细写,但路子一样的 @section head{ <script src="~/Content/jquery-easyui-1.5.5.4/jquery.ea ... 
- layui.table图片显示不全和404问题
		1.图片显示不全 在使用layui.table组件中,加载的图片显示不全,需重新定义CSS如下: .layui-table-cell{ height: auto!important; white-sp ... 
- layui table指定某一行样式
		1.想指定layui table中某一行的样式,找了这个资源可行.转自: https://blog.csdn.net/weixin_44729896/article/details/100524824 ... 
- layui框架中关于table方法级渲染和自动化渲染之间的区别简单介绍
		方法级渲染: <table class="layui-hide" id="LAY_table_user" lay-filter="user&qu ... 
- LayUI table表格控件 如何显示 对象中的属性(针对Mybatis的级联查询--一对一情况)
		1.entity如下: 2.Mybatis的Mapper.xml文件如下 <resultMap id="BaseResultMapPlus" type="dicIt ... 
随机推荐
- PAT 天梯赛 L3-013. 非常弹的球 【物理】
			题目链接 https://www.patest.cn/contests/gplt/L3-013 思路 将速度 分解成 竖直方程 和 垂直方向 当 角度为 45° 时 射出的时候 水平方向 最远 所以 ... 
- 在linux系统下Git源码系统的文件下载
			Git是一个开源的分布式版本控制系统,在linux系统中下载git中的文件使用repo的很多. 网上有很多repo下载的地址失效,目前可用的链接在这里记录一下. 没有安装git的安装一下: sudo ... 
- Ci下面隐藏index.php的方法
			1.需要apache打开rewrite_module,然后修改httpd.conf的AllowOverride none 为AllowOverride All(里面,不同的环境目录不同) 2.在CI的 ... 
- 算法(Algorithms)第4版 练习 1.5.8
			假设原id数组: 0 1 1 4 4 8 6 1 8 0 输入p = 5, q = 7 则输出结果会出错,最终为: 0 1 1 4 4 1 6 1 8 0 因为当id[p](id[5] = 8)被赋值 ... 
- CreateProcess 执行CMD命令,并重定向输出
			1. 参考网址:http://www.cnblogs.com/cnarg/archive/2011/02/20/1959292.html function TfrmMain.ExecDosCmd :b ... 
- R Customizing graphics
			Customizing graphics GraphicsLaTeXLattice (Treillis) plots In this chapter (it tends to be overly co ... 
- Eclipse 下配置MySql5.6的连接池,使用Tomcat7.0
			目前找到的最简单的配置方法. 1.首先在eclipse中创建一个Dynamical Web Application,在WebContent文件夹下的META-INF文件夹中创建新的名为conten ... 
- 分享知识-快乐自己:揭秘HBase
			揭秘HBase: 一):大数据(hadoop)初始化环境搭建 二):大数据(hadoop)环境搭建 三):运行wordcount案例 四):揭秘HDFS 五):揭秘MapReduce 六):揭秘HBa ... 
- Idea_学习_05_Intellij Idea自动添加注释的方法
			二.参考资料 1. Intellij Idea自动添加注释的方法 
- codeforces 86D D. Powerful array(莫队算法)
			题目链接: D. Powerful array time limit per test 5 seconds memory limit per test 256 megabytes input stan ... 
