easyui添加编辑时下拉赋值

添加
在这里插入图片描述
编辑
在这里插入图片描述

var CRUD = {
    add: function () {
        var hDialog = top.jQuery.hDialog({
            title: '添加', width: '70%', height: '80%', href: formurl, iconCls: 'icon-add',
            onLoad: function () {
                top.$('#txt_status').combobox({ url: '/sys/ashx/dichandler.ashx?categoryId=9', valueField: 'Title', textField: 'Title', editable: false, required: true, missingMessage: '', disabled: false });
                top.$('#txt_is_die').combobox({ url: '/sys/ashx/dichandler.ashx?categoryId=10', valueField: 'Title', textField: 'Title', editable: false, required: true, missingMessage: '', disabled: false });
                top.$('.kindeditor').kindeditor();//初始化kingdeditor编辑器
            },
            submit: function () {
                //地区
                var tp = top.$('#txtProvince').val();
                var tc = top.$('#txtCity').val();
                var ta = top.$('#txtArea').val();
                top.$('#txt_sheng').val(tp);
                top.$('#txt_shi').val(tc);
                top.$('#txt_qu').val(ta);
                //alert(top.$("#uiform").form('enableValidation').form('validate'));
                //alert(top.$("#uiform").form('validate'));
                //原来用的是这种方法 alert(top.$('#uiform').validate().form());
                if (top.$("#uiform").form('validate')) {
                    var query = createParam('add', '0');
                    jQuery.ajaxjson(actionURL, query, function (d) {
                        if (parseInt(d) > 0) {
                            msg.ok('添加成功!');
                            hDialog.dialog('close');
                            grid.reload();
                        } else {
                            if (d == -1) {
                                top.$.messager.alert('提示', '该人员已存在,无法进行添加!', 'warning');
                            } else {
                                MessageOrRedirect(d);
                            }
                        }
                    });
                    return;
                }
                msg.warning('请填写必填项!');
                return false;
            }
        });

        top.$('#uiform').validate();
    },
    edit: function () {
        var row = grid.getSelectedRow();
        if (row) {
            var hDialog = top.jQuery.hDialog({
                title: '编辑', width: '70%', height: '80%', href: formurl, iconCls: 'icon-save',
                onLoad: function () {
                    top.$('#txt_KeyId').numberspinner('setValue', row.KeyId);
                    top.$('#txt_ownner').numberspinner('setValue', row.ownner);
                    top.$('#txt_depid').numberspinner('setValue', row.depid);
                    top.$('#txt_status').combobox({ url: '/sys/ashx/dichandler.ashx?showType=noselected&categoryId=9', valueField: 'Title', textField: 'Title', editable: false, required: true, missingMessage: '', disabled: false, onLoadSuccess() { top.$('#txt_status').combobox('setValue', row.status); } });
                    
                    top.$('#txt_is_die').combobox({ url: '/sys/ashx/dichandler.ashx?showType=noselected&categoryId=10', valueField: 'Title', textField: 'Title', editable: false, required: true, missingMessage: '', disabled: false, onLoadSuccess() { top.$('#txt_is_die').combobox('setValue', row.is_die); } });
                    top.$('#txt_name').textbox('setValue', row.name);
                    top.$('#txt_identNum').textbox('setValue', row.identNum);
                    top.$('#txt_disableNum').textbox('setValue', row.disableNum);
                    top.$('#txt_sex').textbox('setValue', row.sex);
                    top.$('#txt_nation').textbox('setValue', row.nation);
                    top.$('#txt_cardStatus').textbox('setValue', row.cardStatus);
                    top.$('#txt_disableKind').textbox('setValue', row.disableKind);
                    top.$('#txt_disableLevel').textbox('setValue', row.disableLevel);
                    top.$('#txt_disableReason').textbox('setValue', row.disableReason);
                    top.$('#txt_huKouKind').textbox('setValue', row.huKouKind);
                    top.$('#txt_phone').textbox('setValue', row.phone);
                    top.$('#txt_telphone').textbox('setValue', row.telphone);
                    top.$('#txt_address').textbox('setValue', row.address);
                    top.$('#txt_address_Reg').textbox('setValue', row.address_Reg);
                    top.$('#txt_guardianName').textbox('setValue', row.guardianName);
                    top.$('#txt_unitName').textbox('setValue', row.unitName);
                    top.$('#txt_sheng').val(row.sheng);
                    top.$('#txt_shi').val(row.shi);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值