extjs form表单怎么绑定数

表单里的xtype: 'textfield',怎么绑定store里的数据。或者怎么把后台json数据直接赋值给文本框

http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.form.Panel-method-loadRecord

不是有API,调用loadRecord方法就行,建立好模型,然后创建模型对应的记录集后调用方法加载

 Ext.define('record', {extend: 'Ext.data.Model',fields: [{ name: 'to' }, { name: 'subject'}]});//和你的表单的字段name一致
var r=Ext.create('record',{to:'showbo',subject:'hello'});
form.loadRecord(r)
    var myFormPanel =  new Ext.form.Panel({
        title: '详细信息',
        bodyPadding: 10,
        layout: 'anchor',
        defaults: {
            anchor: '100%'
        },
        items: [{
            xtype: 'textfield',
            id:'dd',
           readonly:true,
           fieldLabel: '标    题',
           disabled: true,
           style: 'opacity:1',
           name:'ITEM'
       },{
           xtype: 'textarea',
           fieldLabel: '内    容',
           disabled: true,
           style: 'opacity:1',
           name:'INFO'
       },{
           xtype: 'textfield',
           fieldLabel: '附件',
           disabled: true,
           style: 'opacity:1',
           name:'ACCESSORY'
       },{
           xtype: 'textfield',
           fieldLabel: '重要程度',
           disabled: true,
           style: 'opacity:1',
           name:'MARK'
       },{
           xtype: 'textfield',
           fieldLabel: '申请人',
           disabled: true,
           style: 'opacity:1',
           name:'EMPID'
       },{
           xtype: 'textfield',
           fieldLabel: '申请时间',
           disabled: true,
           style: 'opacity:1',
           name:'CLAIM_TIME'
       },{
        xtype: 'fieldset',
        title: '',
        layout: 'anchor',
        title: '签核信息',
        border:false,
        defaults: {
            anchor: '100%'
        },
        items: [{
            xtype: 'radiogroup',
            fieldLabel: '决    策',
            cls: 'x-check-group-alt',
            items: [
                {boxLabel: '同意', name: 'rb-auto', inputValue: 1, checked: true},
                {boxLabel: '不同意', name: 'rb-auto', inputValue: 2}
            ]
        },{
            xtype: 'textarea',
            fieldLabel: '意    见'
        },{
            xtype:"fieldcontainer" , layout:"hbox" , items:[
             {xtype:"textfield" , fieldLabel:"邀请成员" , flex:1} , 
             {xtype:"button" , text:"请选择... ", handler: showContactForm}        
            ] 


        }]
    }],
    buttons: [{
        text: '确定',
        handler: function(){

        }
    },{
        text: '重置',
        handler: function() {
            this.up('form').getForm().reset();
        }
    }]
    });

    Ext.create('Ext.Viewport', {
        layout:'anchor',
        items:[myFormPanel,{
            title:'历史流程',
            border:false,
            autoScroll : true,
            html:'',
            anchor:'100% 20%',
            items:[grid]
        }]
    });

    myFormPanel.render(document.body);
    Ext.define("taskList",{
        extend:"Ext.data.Model",
        fields:  [
                 {name: 'taskList.ITEM',type:'string'},
                 {name: 'taskList.INFO',type:'string'},
                 {name: 'taskList.ACCESSORY',type:'string'},
                 {name: 'taskList.MARK',type:'int'},
                 {name: 'taskList.EMPID',type:'string'},
                 {name: 'taskList.CLAIM_TIME',type:'string'}
                ]
    });

    Ext.Ajax.request({
        url:'taskList.action?task_id='+task_id, 
        success:function(response,options){ 
            var o = Ext.JSON.decode(response.responseText); 
            var control = o[0].control; 
            alert(control.dataTpName); 
            //Ext.getCmp("tNDataTPId").setValue(o.name); 
            } 
    });
//去掉tasklist.这个前缀,和你的formpanel里面的不一致,如果你返回的json数据键名称带tasklist.,一定要去掉,要不就修改formpanel,增加这个前缀
 Ext.define("taskList", {
    extend: "Ext.data.Model",
    fields: [
                 { name: 'ITEM', type: 'string' },
                 { name: 'INFO', type: 'string' },
                 { name: 'ACCESSORY', type: 'string' },
                 { name: 'MARK', type: 'int' },
                 { name: 'EMPID', type: 'string' },
                 { name: 'CLAIM_TIME', type: 'string' }
                ]
});
Ext.Ajax.request({
    url: 'taskList.action?task_id=' + task_id,
    success: function (response, options) {
        var o = Ext.JSON.decode(response.responseText);
        var control = o[0].control;
        var r = Ext.create('taskList', control); //不懂你的control对象有什么键名称,一定要和Ext.form.Panel-> items里面的name值一致
        myFormPanel.loadRecord(r);
    }
});
 var storeList = Ext.create('Ext.data.ArrayStore', {
        //设置分页大小  
        remoteFilter : true,       
        proxy: {             
            type: 'ajax',
            url: 'taskList.action?task_id='+task_id, 
            reader: {
                type: 'json',
                root: 'taskList'                  
            }
       },
        fields: [
           {name: 'TASK_ID',       type: 'string'},
           {name: 'ITEM',       type: 'string'},
           {name: 'INFO',       type: 'string'},
           {name: 'MARK',       type: 'int'},
           {name: 'CLAIM_TIME', type: 'string'}
        ],

        autoLoad: false

    });
    myFormPanel.loadRecord(storeList);