我正在尝试将KnockoutJS与jQuery UI一起使用.我有一个带有日期选择器的输入元素.我目前正在运行knockout.debug.1.2.1.js,似乎更改事件永远不会被Knockout捕获.元素看起来像这样:
<input type="text" class="date" data-bind="value: RedemptionExpiration"/>
Run Code Online (Sandbox Code Playgroud)
我甚至尝试改变valueUpdate事件类型但无济于事.Chrome似乎focus在更改值之前导致事件,但IE不会.
是否有一些"重新绑定所有绑定"的Knockout方法?从技术上讲,我只需要在将其发送回服务器之前更改值.所以我可以忍受这种解决方法.
我认为问题是datepicker的错,但我无法弄清楚如何解决这个问题.
有任何想法吗?
使用knockout将日期值绑定到文本框时出现问题,如下图所示

当第一次加载页面时,我使用ajax来获取AccountStatements数据.
function AccountStatementViewModel(companyID) {
var self = this;
...
var AccountStatement = {
AccountStatementID: self.AccountStatementID,
CompanyID: self.CompanyID,
Description: self.Description,
Amount: self.Amount,
ReceiptDate: self.ReceiptDate,
Type: self.Type
}
self.AccountStatement = ko.observable();
self.AccountStatements = ko.observableArray();
$.ajax({
url: webroot + 'AccountStatement/GetAccountStatements',
contentType: 'application/json; charset=utf-8',
data: { id: self.CompanyID },
cache: false
}).done(function (data) {
self.AccountStatements(data);
});
...
self.edit = function (accountStatement) {
$('#lnkAddAccountStatement').hide('blind', 1000);
$('#pnlAddEditAccountStatement').show('blind', 1000);
self.AccountStatement(accountStatement);
}
...
}
Run Code Online (Sandbox Code Playgroud)
Controller在json中返回结果:
public JsonResult GetAccountStatements(int id)
{
var accountStatementsVM = db.AccountStatements
.Where(a => a.CompanyID …Run Code Online (Sandbox Code Playgroud)