在我的kendo下拉列表中填充了选项之前,我希望optionLabel为“等待加载”#39;然后在填充之后我想将标签更改为' - 选择 - '。
我失败的尝试:
HTML:
<select k-ng-disabled="table.LevelDropDown.disabled"
ng-disabled="table.LevelDropDown.disabled"
kendo-drop-down-list
k-data-text-field="'value'"
k-data-value-field="'GUID'"
k-options="table.LevelDropDown.options"
k-data-source="table.LevelDropDown.list"
k-ng-model="table.LevelDropDown.currentSelected"></select>
控制器中的(初始对象状态):
[...]
LevelDropDown: {
currentSelected: null,
disabled: true,
list: [{value: null, GUID: null}],
options: {
optionLabel: "Wait for loading"
},
resetFields: function () {
$scope.LevelDropDown.currentSelected = null;
$scope.LevelDropDown.list = [{ value: null, GUID: null }];
$scope.LevelDropDown.disabled = true;
$scope.LevelDropDown.options.optionLabel = "Wait for loading";
}
然后在代码的某处,我会尝试将显示标签更改为&#39; - 选择 - &#39;
$scope.teamPermissions.addModalFields.OrgAccessLevelDropDown.options.optionLabel = "--Select--";
答案 0 :(得分:2)
尝试在dataBound
事件中使用此功能:
var changeOptionLabel = function(text) {
var ddl = $("select").data("kendoDropDownList");
ddl.optionLabel.text(text)
ddl.options.optionLabel = text;
ddl.refresh();
ddl.select(0);
};