日期:2014-05-16 浏览次数:20402 次
与服务器的交互,因为后台不是自己写的也不是很清楚
js这里的话
先见一个store
?
var store = new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:'相应的action'}),
reader : new Ext.data.JsonReader({
root:'rows'},
[
{name:'siteid',mapping:'cell.siteid'},
{name:'functionName',mapping:'cell.functionName'},
{name:'createrName',mapping:'cell.createrName'},
{name:'createdatetime',mapping:'cell.createdatetime'},
{name:'dscp',mapping:'cell.dscp'}
]
),
autoLoad:true
});
?name:是自定义的,可以用于下面的程序索引
而mapping这是根据服务器发回的json取的,这里可以通过firebug查看http传输回来的信息:打开firebug,选择控制台,选择所有,点击任意返回信息,单机查看标签栏。见附件
其格式如下:
?
?看到rows下有cell节点,并根据cell下的节点名映射到cell.siteid。
?
combox的使用
这里是作为 配置项存在
?
?
items:[
{
widthidth:150,
layout:'form',
border:false,
items:[{fieldLabel:'站点名称',
xtype:'combo', //combobox的xtype是combo
id:'siteName',
name:'siteName',
border:false,
store:siteStore,
mode:'local',
triggerAction:'all', //此处设置为‘all’,默认情况下在选择一项后,下次单击下拉列表,就只显示显示的那一项了。
displayField:'siteName', //显示在页面的内容
valueField:'siteid', //实际值
emptyText:'请选择站点'}] //为空时文本提示
}
]
?关于combobox的取值,
假设combobox中的id为 com
Ext.get('com').dom.value可以得到displayField的内容
Ext.getCmp('com').getValue可以得到valueField的内容
?
?
?