E_T

导航

Ext.Form 自动填写表单内容

Posted on 2015-05-11 10:03  E_T  阅读(275)  评论(0编辑  收藏  举报

 

前台:

表单必须含有name属性

if (action == 'edit' || action == 'show') {
                MyForm1.getForm().load({
                    url: '/data/customer/FollowHandler.ashx',
                    params: {
                        action: 'getModel', cusId: cusId
                    },
                    success: function(g, h) {  
                        var e = Ext.decode(h.response.responseText).data;
                        var startDate = e['Follow_date'].split('T');
                        Ext.getCmp("Follow_date").setValue(startDate[0]);
                    },
                    failure: function (form, action) {
                        Ext.Msg.alert("读取失败!", action.result.errorMessage);
                    }
                });
            }

 

后台:

                Model.hr_employee model = bllEmp.GetModel(id);
                model.sex = model.sex == "男" ? "1" : "2";//下拉框
                model.status = model.status == "在职" ? "1" : "2";
                model.pwd = "";
                context.Response.Write(JsonConvert.SerializeObject(new { success =true,data=model}));