Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
255 views
in Technique[技术] by (71.8m points)

javascript - javascript popup不会弹出,因为绑定已分配(javascript popup doesn't pop because bindings already assigned)

The c# '/Clients/ClientSelectDataTable' gets called and returns.

(c#'/ Clients / ClientSelectDataTable'被调用并返回。)

      self.LookupClient = function () {
          $.ajax({
              type: 'POST',
              url: '/Clients/ClientSelectDataTable'
          }).done(function (msg) {
              //grab the partial from the controller
              $("#SelectClient").html('');
              $("#SelectClient").html(msg);
              //initialize the js
              theClientPicker = new ClientSelectModel('ClientSelectDataTable', '/API/GetAllClients', AssignClient, self.CancelClientSelect, "Select");
              ko.applyBindings(theClientPicker, $("#SelectClient")[0]);

              $.fancybox("#SelectClient", { //launch ClientSelect widget
                  modal: true,
                  afterClose: function () {
                      theClientPicker.Dispose();
                      ko.cleanNode($("#SelectClient")[0]);
                  }
              });
          });
      }

It throws an exception here ko.applyBindings(theClientPicker, $("#SelectClient")[0]);

(它在这里引发异常ko.applyBindings(theClientPicker,$(“#SelectClient”)[0]);)

...

(...)

    if (!sourceBindings) {
        if (alreadyBound) {
            throw Error("You cannot apply bindings multiple times to the same element.");

I can catch the exception, but the pop-up doesn't work because the events on the buttons are not assigned.

(我可以捕获到异常,但是由于未分配按钮上的事件,所以弹出窗口不起作用。)

It is a new theClientPicker so I can't see how it can already be assigned.

(这是一个新的theClientPicker,所以我看不到如何分配它。)

  ask by BWhite translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found the issue.

(找到了问题。)


This is either a bug or a breaking change in knockout, introduced between 3.4.2 and 3.5.0.

(这是3.4.2和3.5.0之间引入的缺陷或重大缺陷。)


Reverting back to, and freezing on, 3.4.2 fixes it.

(恢复并冻结3.4.2可以修复它。)

Is there a proper way to report this?

(有没有适当的方式来报告此情况?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...