1.Ext.Ajax.request
Ext.Ajax.request({ url: "url.action", params: {}, success: function(response){ var result = eval('(' + response.responseText + ')'); if(result.success){ alert("success") }else{ alert("fail"); } } }); var task = new Ext.util.DelayedTask(function(){ btn.setDisabled(false); }); task.delay(10000);
2.Ext延迟执行任务
var task = new Ext.util.DelayedTask(function(){ btn.setDisabled(false); }); task.delay(10000);
3.Form.load
form.getForm().load({ url:'url.action', method:'post', params:{ id:id }, success:function(form,action){ }, failure:function(form,action){ } });
4.Form.submit
form.submit({ success : function(form, action) { }, failure : function(form, action) { } });
5.查询Store可以指定查询第几页
Number page, Object options )
loadPage(
Loads a given 'page' of data by setting the start and limit values appropriately. Internally this just causes a normal load operation, passing in calculated 'start' and 'limit' params
Parameters
- page : Number
The number of the page to load
- options : Object
See options for load
//如回到首页 store.loadPage(1);
6.Store中的Json附带除root和totalProperty以外的其他信息
Java端将otherProperty属性放入Json中,ExtJs如下写
Ext.create('Ext.data.Store', { storeId : 'store', model : 'model', pageSize : 20, proxy : { type : 'ajax', url : 'url.action', reader : { type : 'json', root : 'root', totalProperty : 'count', otherProperty: 'otherProperty' } } });
如下方式可获取
store.getProxy().getReader().jsonData.otherProperty