美文网首页
layui动态表格监听单选框单击事件

layui动态表格监听单选框单击事件

作者: 绿峰 | 来源:发表于2019-05-12 19:13 被阅读0次

layUI的动态表格插件,指定当前列是单选框,那么如何获得单击事件并拿到当前行数据呢?

话不多说,上码!

// 框架初始化

$(function(){

        layui.use(['table','laydate','layer'], function() {

            var table = layui.table;

            var laydate = layui.laydate;

            var layer = layui.layer;

            table.init('my_table_1', {

                        //表格初始化参数

                        height: document.body.clientHeight-55,  //动态高度

                        cellMinWidth: 100,  //最小宽度

                        skin: "nob",      //表格风格 line row nob

                        even: true,        //是否隔行变色

                        limit: 10000,

                        done: function(res, curr, count) {

                            // 监听单选单击事件,其中my_table_1是table的lay-filter的属性值

                            table.on('row(my_table_1)',function(obj){   

                            // 其中,obj是单选后当前行的数据

                                window.parent.document.getElementById("contents").contentWindow.reSeGYS(obj.data.ck2, obj.data.ck3);

                                window.parent.closeWinSelect();

                            });

                        }

                    });

        });

});

相关文章

网友评论

      本文标题:layui动态表格监听单选框单击事件

      本文链接:https://www.haomeiwen.com/subject/cpqhaqtx.html