1, Ext AJAX Store and from timeout solution
when using the ext grid, if the background calculation is large or the amount of data returned is too large to cause the load data time-out, time-out will find that the grid has no data display. The workaround is to set the time-out to a large point, and the AJAX default request for Ext is 30 seconds. The Setup method is as follows:Ext.Ajax.timeout = 90000; one second =1000 milliseconds. The above setting is to set timeout to 90 seconds.
The From object of Ext also has a time-out problem when loading data asynchronously. The workaround is as follows:ext.data.connection.prototype.timeout= ' 9000 '; sets the Ajax request time by default of 30 seconds.
2. ExtJs4 fields and root names are case-sensitive when reading XML files
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 file format: Add root directory ' DataSet ' to multiple records
<?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>