弹出窗口不显示内容

时间:2015-02-02 09:25:05

标签: javascript jquery knockout.js jquery-ui-dialog

我在代码中添加了一个Jquery弹出窗口。单击编辑按钮时,弹出窗口将打开数据,该数据保存在数组' editAccount'中。它适用于第一次加载,但在几次使用后,数据不会显示在弹出窗口中。

INSIDE JS FILE

/** View model in JS*/
function ClientViewModel() {
    var self = this;
    self.editAccount = ko.observableArray([]);
    .
    .
    .
  }

HTML

/** Method in HTML*/
 var clientViewModel = new ClientViewModel();
 clientViewModel.editAccount = function (item) {
            editSecItem = item;
            //console.log(item.ioru())
            var element = $('#accountDet')[0];
            ko.cleanNode(element);
            ko.applyBindings(item, element);
            dialog.dialog("open");

        } .bind(clientViewModel);

POPUP

    ko.applyBindings(clientViewModel, document.getElementById("clientDef"));
        dialog = $("#dialog-form").dialog({
            autoOpen: false,
            height: 390,
            width: 450,
            modal: true,
            close: function () {
                if (editSecItem.accountNumber() == "") {
                    clientViewModel.removeAccount(editSecItem);
                }
            }
        });

POPUP HTML

<div style="display: none">
    <div id="dialog-form" title="Account">
        <table id="accountEdit" cellpadding="3" cellspacing="1">
            <tbody>
                <tr>
                    <td>
                         Account Number
                    </td>
                    <td>
                        <input type="text" data-bind="value:accountNumber">
                    </td>
                </tr>
                 <tfoot>
                <tr>
                    <td align="center" colspan="2">
                        <span class="btn btn-block btn-primary btn-icon glyphicons ok" onclick="dialog.dialog('close');">
                            <i></i>Done</span>
                    </td>
                </tr>
            </tfoot>
        </table>
    </div>
</div>

0 个答案:

没有答案