0

我目前有一个 wijmo 网格,在绑定完成后会出现一个带有复选框的列列表。我想将复选框添加到弹出窗口中,以便仅在单击时可见。以下代码是我必须隐藏和取消隐藏选中和未选中条件的列。

 self.hideCols = function () {
            var columns = $('#Grid').wijgrid("option", "columns"),
                       listContainer = $("#columnsList"),
                       checkBox, isChecked;

            $.each(columns, function (index, col) {
                isChecked = (col.visible)
                    ? "checked = 'checked'"
                    : "";

                checkBox = $("<label><input type='checkbox' " + isChecked + " />" + col.headerText + "</label>");
                listContainer.append(checkBox);
                checkBox.click(function (e) {
                    columns[index].visible = $(this).children("input")[0].checked;
                    $('#Grid').wijgrid("doRefresh");
                })
4

1 回答 1

1

我知道了。只需使用 HTML 创建一个弹出窗口并将列列表包含在 <div id="dialog" data-bind="wijdialog: {disabled: disabled, autoOpen: autoOpen, draggable: draggable, modal: modal, resizable: resizable }" title="Uncheck to Hide Columns"> <table id="columnsList"></table> </div>

于 2015-06-24T15:21:08.753 回答