我试图在optionsAfterRender事件之后运行一些代码,但我的函数createPortfolioMultiselect没有被调用且没有错误。
<select id="PortfolioSelector" data-bind="options: listEntities, optionsText: 'name', optionsValue: 'id', optionsAfterRender: createPortfolioMultiselect, value: selectedPortfolio, event: { change: portfolioChanged }"></select>
mViewModel = {
selectedPeriod: ko.observable(),
listPeriods: ko.observableArray(),
selectedPortfolio: ko.observable(),
selectedPortfolioText: ko.observable(),
listEntities: ko.observableArray(),
periodChanged: function (pContext) {
// do some work
},
portfolioChanged: function () {
// do some work
},
createPortfolioMultiselect: function (option, item) {
// do some work here
},
LastRunReports: ko.observableArray()
};
答案 0 :(得分:1)
我使用的旧版淘汰赛2.2.1不支持此功能。用户错误。