ノックアウトオブジェクトを更新するために隠れたドロップダウンリストを使用するjquery UIコンボボックスがあります。ドロップダウンリストを表示すると、ノックアウトオブジェクトが適切に更新され、値が変更されます。コンボボックスの値を変更すると、ドロップダウンに変更が反映されますが、ノックアウトオブジェクトは変更されません。ドロップダウンリストの値が変更されても、changesubgroupは呼び出されません。私はchangesubgroupイベントを発生させるために必要です。javascript and knockout combobox
EmployerGroupModel.prototype.ChangeSubGroup = function() {
try {
if (this.CurrentSubGroupValue()) {
var tempGroupsResults;
var updateCurrentSubGroup = false;
var len = this.SubGroupsResults().length - 1;
for (i = 0; i < len; i++) {
if (this.CurrentSubGroup() != undefined)
{
if (this.CurrentSubGroup().EMPL_GRP_DTL_KY != undefined) {
if (this.SubGroupsResults()[i].EMPL_GRP_DTL_KY == this.CurrentSubGroup().EMPL_GRP_DTL_KY) {
if (this.SubGroupsResults()[i] != this.CurrentSubGroup())
{
tempGroupsResults = this.SubGroupsResults().filter(this.ExcludeFilter);
tempGroupsResults.push(this.CurrentSubGroup());
this.SubGroupsToUpdate.push(this.CurrentSubGroup());
updateCurrentSubGroup = true;
}
}
}
}
}
var myObject = this.SubGroupsResults().filter(this.ArrayFilter)[0];
if (updateCurrentSubGroup)
{
this.SubGroupsResults(this.tempGroupsResults());
}
this.CurrentSubGroup(myObject);
}
} catch (e) {
alert(e.toString());
}
};