日期:2014-05-16 浏览次数:20423 次
EXT的from对象在异步加载数据的时候也会出现超时的问题。解决方法如下:Ext.data.Connection.prototype.timeout='9000';设置ajax请求时间默认30秒。
2、ExtJs4 读取XML文件时 字段和根名都要区分大小写
Ext.define('MyData',{
extend: 'Ext.data.Model',
fields: [{ name:'Job_id', mapping: 'Job_id'}
,'Job_desc'
,'Min_lvl'
,'Max_lvl'
]
});
var store = Ext.create('Ext.data.Store', {
storeId: 'DataStore',
autoLoad: true,
model: 'MyData',
proxy: {
type: 'ajax',
url: 'MyXmlData.xml', //'GetExtjsData.aspx?parm=List',
reader: {
type: 'xml',
root: 'dataset',
record: 'record'
}
}
});
xml文件格式:多记录时要加根目录‘dataset’
<?xml version='1.0' encoding='utf-8'?>
<dataset>
<record>
<Job_id>1</Job_id>
<Job_desc>name1</Job_desc>
<Min_lvl>23</Min_lvl>
<Max_lvl>33</Max_lvl>
</record>
<record>
<Job_id>2</Job_id>
<Job_desc>name1</Job_desc>
<Min_lvl>23</Min_lvl>
<Max_lvl>33</Max_lvl>
</record>
</dataset>