日期:2014-05-16  浏览次数:20815 次

ext的label数据显示问题 - Web 开发 / Ajax
问题如题。
java返回的JSON为:{results:1,OA:[{"password":"","userName":"超级系统管理员","pageMessage":"","pageEnd":"","thisDate":"","creater":"","lastDate":"2011-10-01 00:00:00.0","userOrg":"吉广传媒总公司","sts":"","userCode":"admin","roleName":"超级管理员","roleCode":"","pageStart":"","createDate":"","stsTemp":"","orgName":""}]}
JS代码: var userDetail = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: '/OA/main!getUserDetail.action?dateTime='+new Date().getTime()}),
reader: new Ext.data.JsonReader({
root: 'OA',
totalProperty: "results",
fields:["userCode"]
}),
remoteSort: true
});

userDetail.load();

var fieldSet = new Ext.form.FieldSet({
title: '个人信息',
  autoHeight: false,
  width: 220,
  height: 400,
defaultType: 'textfield',
  items: [{
xtype: 'label',
text:'用户ID',
name: 'userCode',
id:'userCode',
anchor:'95%'
}] 
  })
   
var fp = new Ext.FormPanel({
id:'ext_form',
labelWidth: 100, 
waitMsg:'正在提交,请稍后...',
frame:true,
bodyStyle:'padding:5px 5px 0',
reader: new Ext.data.JsonReader({
root: 'OA',
totalProperty: "results",
fields:["userCode"]
}),
items: [fieldSet] 
});
var onePanel = new Ext.Panel({
id:'onePanel',
split:true,
layout: 'fit',
minWidth: 100,
minHeight: 100,
title :'[个人信息]',
collapsible: true,
width:250,
items:[fp],
region:'west'
});
var twoPanel = new Ext.Panel({
split:true,
id:'twoPanel',
minWidth: 100,
minHeight: 100,
collapsible: true,
layout: 'fit',
region:'center'
});

Ext.onReady(function(){
Ext.QuickTips.init(); 
   Ext.form.Field.prototype.msgTarget = 'side';
Ext.BLANK_IMAGE_URL = "../../script/ext-2.0.2/resources/images/default/s.gif";
new Ext.Viewport({
title : '『主页』',
layout:'border',
items: [onePanel,twoPanel]
});
})

目前页面上只显示 “用户ID”。 “admin”显示不出来!


------解决方案--------------------
我就没看出来 你的 userDetail 数据源和form有什么关系。。
------解决方案--------------------
LZ你只定义了一个store,有没有地方调用到