如何为 DevExtreme DxCombobox 设置值?
How to set value for DevExtreme DxCombobox?
如何从 javascript 代码设置组合框的值 (SelectedBox)?
组件演示
我需要根据 javascript 代码设置值,我使用 AngularJS!
来自组件的 api 我没看到如何设置它!
http://js.devexpress.com/Documentation/ApiReference/UI_Widgets/dxSelectBox/?version=15_2
有value option in the dxSelectBox API. Well, just set this option. If you want to use a two-way binding for the selectbox value, use the bindingOptions对象。
HTML
<div dx-select-box="{dataSource: data, bindingOptions: { value: 'selectedItem' } }"></div>
JS
myApp.controller("myCtrl", function($scope) {
$scope.data = [/* your data */];
$scope.selectedItem = $scope.data[0];
});
我创建了小样本 here。
如何从 javascript 代码设置组合框的值 (SelectedBox)?
组件演示
我需要根据 javascript 代码设置值,我使用 AngularJS!
来自组件的 api 我没看到如何设置它!
http://js.devexpress.com/Documentation/ApiReference/UI_Widgets/dxSelectBox/?version=15_2
有value option in the dxSelectBox API. Well, just set this option. If you want to use a two-way binding for the selectbox value, use the bindingOptions对象。
HTML
<div dx-select-box="{dataSource: data, bindingOptions: { value: 'selectedItem' } }"></div>
JS
myApp.controller("myCtrl", function($scope) {
$scope.data = [/* your data */];
$scope.selectedItem = $scope.data[0];
});
我创建了小样本 here。