原先的Ext.data.Store一直没有进行错误处理。今天考虑一下,其实很简单
先来看看Store的load()方法
load( Object options
) : void
Parameters:
-
options
: Object
An object containing properties which control loading options:
-
params :Object
An object containing properties to pass as HTTP parameters to a remote data source.
-
callback : Function}
A function to be called after the Records have been loaded. The callback is passed the following arguments:
- r : Ext.data.Record[]
- options: Options object from the load call
- success: Boolean success indicator
-
scope : Object
Scope with which to call the callback (defaults to the Store object)
-
add : Boolean
Indicator to append loaded records rather than replace the current cache.
Returns:
由上可知,可以很轻松的写出Store异常处理
ds.load({params:{start:0, limit:4},
callback:function(r, options, success) {
if (success == false) {
Ext.Msg.alert('错误','数据提取错误') ; //当然也可以做其他的处理操作
}else{
Ext.Msg.alert('提示,'数据提取成功)
}
}
});
分享到:
相关推荐
关于这个原因有很多种,我只说下我遇到的 我这样 写Store来复用的 代码如下: DocStore = Ext.extend(Ext.data.Store,{ initComponent:function(){ this.proxy = new Ext.data.HttpProxy({url:this.url}); this....
6. Ext.data.Store篇 10 7. Ext.data.JsonReader篇一 12 8. Ext.data.JsonReader篇二 15 9. Ext.data.HttpProxy篇 19 10. Ext.data.Connection篇一 20 11. Ext.data.Connection篇二 24 12. Ext.Updater篇一 26 13. ...
6. Ext.data.Store篇 10 7. Ext.data.JsonReader篇一 12 8. Ext.data.JsonReader篇二 15 9. Ext.data.HttpProxy篇 19 10. Ext.data.Connection篇一 20 11. Ext.data.Connection篇二 24 12. Ext.Updater篇一 26 13. ...
ExtJs + api + 笔记 + 完整包
代码如下: var Store = Ext.create(‘Ext.data.Store’, { pageSize: pageSize, model: ‘Ext.data.Model名称’, autoLoad: false, proxy: { type: ‘ajax’, url: ‘请求路径’, getMethod: function(){ return ...
35、Ext.data.Store类 …………………… 28 36、Ext.data.GroupingStore类 ………… 32 37、Ext.data.SimpleStore类 ………… 34 38、Ext.data.Tree类 …………………… 34 39、Ext.data.Node类 ………………… 34 ...
《精通JS脚本之ExtJS框架》由浅入深地讲解了ExtJS在Web开发中的相关技术。本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计...
7.4.5 数据验证及错误处理:ext.data.validations与ext.data.errors / 332 7.4.6 模型的关系:ext.data.association、ext.data.hasmanyassociation和ext.data.belongstoassociation / 334 7.4.7 管理数据模型:...
《精通JS脚本之ExtJS框架》由浅入深地讲解了ExtJS在Web开发中的相关技术。本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计...
extjs4 对多种store数据 ,以多种方式绑定到界面上,以一例子以说明编写
1.使用ExtJS6.5.0+SSM 2.实现Grid表格的增删改查和分页,数据库使用的是MySql, 3.项目代码和数据脚本齐全 4.Jar齐全,加载即可运行 5.VX:humingxing可随时交流
导出Extjs中的store的数据为excel,前段js导出。 Export store to Excel Well, here's an exporter that can export a grid, tree or simply a store to excel. It's a fork from another project, I adapted it ...
Extjs解析xml问题 ... var store=new Ext.data.Store({ url:'GridData.xml', reader:new Ext.data.XmlReader( {record:'Item'}, ["ASIN","Author","Manufacturer","ProductGroup","Title"]) });
需要注意的是,生成的EXTjs 是商业体验版本,如果你购买了,那么你需要下载ext js的zip包,并且使用-SDK命令来制定SDK的路径,这样,就不会去默认下载SDK而是按照你本地的文件来生成了。 命令如下: sencha -sdk /...
代码如下:// 第一个下拉框 var parentStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: ‘loadByParentid.action?parentid=1001’ }), reader: new Ext.data.JsonReader({ root: ‘list’, id: ...
The data store Chapter 8. The grid panel Chapter 9. Taking root with trees Chapter 10. Drawing and charting Chapter 11. Remote method invocation with Ext Direct Chapter 12. Drag-and-drop Part 3: ...
四、Ext.data.Store类 59 五、下拉列表框 60 六、得到下拉列表框的值 62 七、源代码 63 八、小结 64 第十一章:Ajax与ComboBox 65 一、Ajax 65 二、Ext.Ajax类 65 三、Ajax文件上传 67 四、你来自远方 72 五、小结 ...