Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增点击表格内单元格 选中该行变色并当前行CheckBox选中 并单选 #109

Closed
wants to merge 180 commits into from

Conversation

rushChen131
Copy link

//初始化
table.init = function(filter, settings){
settings = settings || {};
var that = this
,elemTable = filter ? $('table[lay-filter="'+ filter +'"]') : $(ELEM + '[lay-data]')
,errorTips = 'Table element property lay-data configuration item has a syntax error: ';
var isOpenCheckOne = settings["isOpenCheckOne"];
if (isOpenCheckOne){
checkBoxInit(that);
}

//单元格选中该行的checkBox选中 只能选择一行
var checkBoxInit = function (table) {
var checkBoxArray = null;
$(document).on('click', 'table tr', function (e){
var evtTarget = e.target || e.srcElement;
if (!$(evtTarget).is('i') ) {
$(this).find(".layui-form-checkbox i").trigger("click");
$(this).addClass('active').siblings().removeClass('active');
var index = $(this).data().index;
var checkBoxTable = $($(document).find("table")[4]);
var div = $(checkBoxTable.find("tr")[index]).find("td")[0];
var checkBox = $(div).find("input");
var divClass = $(div).find("div :eq(1)");
if($(checkBox[0]).prop("checked")){
removeBox(div);
$(this).removeClass('active');
}else{
removeBox(checkBoxArray,index);
checkBoxArray = div;
$(divClass).addClass("layui-form-checked");
$(checkBox[0]).prop("checked",true);
$(this).addClass('active');
}

        }
    });

    function removeBox(td,index) {
        var divClass = $(td).find("div :eq(1)");
        var checkBox = $(td).find("input");
        $(divClass).removeClass("layui-form-checked");
        $(checkBox[0]).prop("checked",false);
        var cache = table.cache[Class.prototype.key];
        for (var i=0;i<cache.length;i++){
            if (cache[i][table.config.indexName] != index){
                cache[i][table.config.checkName] = null ;
            }
        }
    }

sentsin and others added 30 commits September 3, 2017 06:48
* 优化layui测试

* 添加 layui.data 测试

* 添加laydate测试用例

* 修复ie中focus事件延迟

* 修复ff内测试报错

* 修复ff内测试报错
* 添加 laydate 测试

* 添加 options.format 和 options.value 叠加时的验证

* 修改必须单元测试通过后再进行浏览器测试

* 添加判断css是否加载成功

* 优化 options.elem 测试

* 完善laydate测试

* 更新事件回调测试

* 先把 options.format 注释了, 依赖 master 的修复

* 添加 mock server

* 更新404地址

* 使用 show api 来显示日历

* 测试火狐浏览器

* 修复火狐报错

* add callback test case

* fix firefox error

* fix win var

* add window.lay test case

* fix firefox test error

* add edga test

* update `laydate.render({value})` test case

* update options.dateTime test case
修改 form 示例中邮箱类型错误
@sentsim sentsim closed this Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet