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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…