根据组合框中选定的默认项目加载排列,并在更改选定项目时重新加载(淘汰)
Load Spread based on default item selected in the combobox and reload on changing selected item (knockout)
我想根据组合框中选择的默认项目加载页面,并在更改所选项目时重新加载(淘汰)。
目前我正在做的是点击一个按钮加载表单。这是我的密码。请推荐我,因为我对淘汰赛还很陌生。
html:
<select data-bind="options : employeeList, optionsText : 'name', value : selectedEmployeeList"></select>
</span>
<button class="toolbar-button" data-bind="click : load, disable :loading">Load employee</button>
js:
var filterVM = function () {
this.employeeList = ko.observableArray();
this.selectedEmployeeList = ko.observable();
};
dataService.getEmployeeLists(this.viewData.EmployeeId).then(loadEmployeeLists).then(enableControls);
filterVM.prototype.load = function () {
var selectedEmployeeList = this.selectedEmployeeList();
var self = this;
if (selectedEmployeeList) {
disableControls();
dataService.getEmployeeByEmployeeList(this.viewData.employeeId, selectedEmployeeList.id)
.done(loadPEmployeeSpread);
}
};
您可以在更改所选值selectedEmployeeList时调用加载函数在构造函数中添加以下代码
this.selectedEmployeeList .subscribe(function(newValue) {
//This function is going to get called on every change of the selectedEmployeeList
//Add here your code to load the page
}, this);
subscribe:-是knocket提供的一种功能,它可以跟踪订阅变量中的每一次更改,并在每次更改时调用函数。
相关文章:
- Netsuite Suitelet:在不达到治理限制的情况下,遍历事务行项目的列表加载和提交记录
- 无法加载Ace.js编辑器模式和主题(命名空间项目&AMD require.js&grunt
- 如何在页面加载后禁用下拉列表框项目的选择
- 在Knockout JS中搜索从DB加载数据的项目
- HTML/JS github页面项目没有't在使用firefox运行时加载图像或声音
- 如何使用 javascript 从 Web 服务重新加载项目集合
- 没有在django项目中加载CSS文件
- jquery ias插件不适用于我的网站,加载更多项目不起作用
- JQuery Masonry.Ajax图标和“;加载新项目”;绳子放错地方了
- 使用jquery将html文件加载到html中,用于离线/本地项目
- 在新表单上使用JavaScript创建多个共享点项目,但将下一页加载延迟到全部创建
- 限制在角度中过滤是否会阻止在 ng 重复中加载其他项目
- jquery未加载.我需要帮助将jquery添加到我的项目中.它没有加载javascript文件
- 根据组合框中选定的默认项目加载排列,并在更改选定项目时重新加载(淘汰)
- jQuery;Ajax-在页面加载时将项目加载到选择输入
- 根据单击的项目加载 JavaScript
- PHP AJAX分页将项目加载到多个容器中
- 如何将项目加载到无限循环中
- 为d3项目加载csv文件时未定义的值
- 聚合物项目加载缓慢