如何使用Knockout创建弹出窗口



我目前有一个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");
                })

我得到了它。只需要使用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> 中包含列列表

最新更新