如何添加到表选择复选框作为列

时间:2014-05-22 08:08:00

标签: jquery

这里我有一个带复选框的弹出窗口。当我根据table2中弹出的索引选择table1中的复选框时,那些应该在弹出表的外部添加as列。

(弹出窗口有多个复选框,我必须选中几个复选框,然后单击提交按钮在表格中添加列。)

在我的下面的代码中添加到弹出表之外的表,而不是按钮点击:

var cell = $(this).parent("td");
var row = $(cell).parent("tr");
var rowIndex = $('#popout th[id=' + thisId + ']').index();
var columnIndex = (rowIndex);
var tblcolumnscount = $('#popout td').length;
if $('#popout td').length == 0) {
    var colselect = 1;
    $('#popout td,#tblKPLItemList th').addClass('hide');
    $('#popout-l td,#tblKPLItemList-sticky th').addClass('hide');
    $('#popout ,tblKPLItemList-sticky').removeClass('hide');
    $('#popout td:nth-child(' + (colselect + 1) + '),#popout th:nth-child(' + (colselect + 1) + ')').removeClass('hide');
    $('#popout-l td:nth-child(' + (colselect + 1) + '),#popout-l th:nth-child(' + (colselect + 1) + ')').removeClass('hide');
}

if (checked) {
    var Fid = $(this).closest('table').attr('id');
    if (Fid == 'ColumnsSelect') {
        var Checkedrow = $(this).closest('tr').html();
        $('#tblpopup2 tbody').append('<tr class="' + thisId + '">' + Checkedrow + '</tr>');
        $("#tblpopup2 tbody input").attr("checked", "checked");
    }
$('#popout td:nth-child(' + (columnIndex + 1) + '),.display th:nth-child(' + (columnIndex + 1) + ')').removeClass('hide');
$('#popout-l td:nth-child(' + (columnIndex + 1) + '),#popout-l th:nth-child(' + (columnIndex + 1) + ')').removeClass('hide');

0 个答案:

没有答案