关于修改表单界面的form数据回显问题[急]:checkbox radio combo

commanderhyk 2008-07-25
如题
对于常规表单通过
form中加入
reader: new Ext.data.JsonReader(
{root:'data'},
    [{name: 'textarea',mapping:'textarea',type:'string'},
     {name: 'mydate',mapping:'mydate',type:'string'},
     {name: 'combo1',mapping:'combo1',type:'string'}
    ]
)

事件中加入
form.getForm().load( {
                url : 'post.jsp?task=2',
                waitMsg : '正在载入数据...',
                success : function(_form,action) {
                    Ext.MessageBox.alert('编辑', '载入成功!');
                },
                failure : function(_form,action) {
                    Ext.MessageBox.alert('编辑', '载入失败');
                }
});
就可以正常的表单反填.
那么对于combo checkbox radio这些种类的控件如何反填值的选中状态?
谢谢
mercuryzhang 2008-07-25
期待...
以前的人好象说只有用setValue()
guhe10 2009-12-03
<%@ page language="java" import="java.util.*" isELIgnored="false" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>初始版本</title>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/resources/css/ext-all.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/ext-all.js"></script>
  <script type="text/javascript">
  Ext.onReady(function(){
                Ext.QuickTips.init();
                // turn on validation errors beside the field globally
                Ext.form.Field.prototype.msgTarget = 'side';
               
                var fs = new Ext.FormPanel({
                    frame: true,
                    title: 'jsomn Form',
                    labelAlign: 'right',
                    labelWidth: 85,
                    width: 340,
                    waitMsgTarget: true,
                    renderTo:'formdiv',
                    // configure how to read the json Data
                    reader: new Ext.data.JsonReader(
{root:'data'},
    [{name: 'first',mapping:'first',type:'int'},
     {name: 'last',mapping:'last',type:'int'},
     {name: 'company',mapping:'company',type:'int'},
     {name: 'add',mapping:'add',type:'string'}
    ]
),
                    items: [new Ext.form.FieldSet({
                        title: 'Contact Information',
                        autoHeight: true,
                        defaultType: 'textfield',
                        items: [{
                            fieldLabel: 'First Name',
                            name: 'first',
                            width: 190
                        }, {
                            fieldLabel: 'Last Name',
                            name: 'last',
                            width: 190
                        }, {
                            fieldLabel: 'Company',
                            name: 'company',
                            width: 190
                        },{
                 //columnWidth:.5,// 宽度为50%
                 xtype:"checkbox",
                 boxLabel:"添加角色",// 显示在复选框右边的文字
                 name:"add"
                 // anchor:'90%'
             }]
                    })]
                });
               
                fs.render('form-ct');
                fs.form.load({
                    url: 'userGroupManage.htm?method=userGroup_RoleSet',
                    method: 'GET',
                    waitMsg: 'Loading'
                });
               
            });
    </script>
  </head>
    <body>
<div id='formdiv' style="width: 100%;height:100%"></div>
    </body>  
   
</html>
Global site tag (gtag.js) - Google Analytics