DevExtreme 学习应用[3]

DevExtreme dxSelectBox 联动查询案例

        //数据获取
        lookupDataSource = new DevExpress.data.DataSource({
            store: storeInitValue, //数据源
            sort: { getter: "time", desc: true }, //排序
            filter: ["ProjectKey", "=", Application1.ProjectKey],  //过滤
            map: function (item) {
                return new ini_valueViewModel(item);
            }
        });

        //数据更新
        function handleDataSourceChanged() {
            isReady.resolve();
            lookupDataSource.off("changed", handleDataSourceChanged);
        }
        lookupDataSource.on("changed", handleDataSourceChanged);

        return {
            typedatasourceChange: function (e) {
                //从新更新数据
                lookupDataSource.filter([["ProjectKey", "=", Application1.ProjectKey], '&&', ["TypeName", "=", e.value]]);
                lookupDataSource.reload();
                //数据重新加载
            },
            typedatasource: typedatasource, //类型
            lookupDataSource: lookupDataSource, //名称
            control: control,
            handleSave: handleSave,
            handleCancel: handleCancel,
            viewShowing: handleViewShowing,
            isReady: isReady.promise()
        };
<div data-options="dxView : { name: 'ControlEdit', mode: 'edit', title: '测点设置' } ">
    <div data-bind="dxCommand: { onExecute: handleSave, id: 'save', title: 'Save', icon: 'save' } "></div>
    <div data-bind="dxCommand: { onExecute: handleCancel, id: 'cancel', behavior: 'back', title: 'Cancel', icon: 'close' }"></div>
    <div data-options="dxContent : { targetPlaceholder: 'content' } " class="dx-edit-view dx-content-background dx-form-background" data-bind="dxDeferRendering: { showLoadIndicator: true, staggerItemSelector: '.dx-field', animation: 'edit-item-rendered', renderWhen: isReady }">
        <div data-bind="dxScrollView: { }">
            <div class="dx-fieldset">
                <div class="dx-field">
                    <div class="dx-field-label">测点类型: </div>
                    <div data-bind="dxSelectBox:{
                                    dataSource: typedatasource,
                                    placeholder: '测点分类',
                                    displayExpr: 'Name',
                                    valueExpr: 'TableName',
                                    value: control.TypeName,
                                 onValueChanged:typedatasourceChange}">
                    </div>
                </div>
                <div class="dx-field">
                    <div class="dx-field-label">测点名称: </div>
                    <div data-bind="dxSelectBox:{
                                    dataSource: lookupDataSource,
                                    placeholder: '测点编号',
                                    displayExpr: 'name',
                                    valueExpr: 'name',
                                    value: control.name}">
                    </div>
                </div>

                <div class="dx-field">
                    <div class="dx-field-label">控制值: </div>
                    <div class="dx-field-value" data-bind="dxNumberBox: { value: control.WarningUp, placeholder: '控制值' }"></div>
                </div>
                <div class="dx-field">
                    <div class="dx-field-label">报警值: </div>
                    <div class="dx-field-value" data-bind="dxNumberBox: { value: control.EarlyWarningUp, placeholder: '报警值' }"></div>
                </div>
            </div>
        </div>
    </div>
</div>

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值