Extjs Store 的异常错误处理
2012-11-20 19:19
141 查看
先来看看Store的load()方法
load(
Parameters:
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('提示,'数据提取成功)
}
}
});
出错信息可以在options.request.scope.reader.jsonData 或 options.request.scope.reader.rawData 中获得。
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:
void
由上可知,可以很轻松的写出Store异常处理
ds.load({params:{start:0, limit:4},
callback:function(r, options, success) {
if (success == false) {
Ext.Msg.alert('错误','数据提取错误') ; //当然也可以做其他的处理操作
}else{
Ext.Msg.alert('提示,'数据提取成功)
}
}
});
出错信息可以在options.request.scope.reader.jsonData 或 options.request.scope.reader.rawData 中获得。
相关文章推荐
- js 异常处理 错误不弹出窗口
- 第十二章 通过异常处理错误
- php日志错误异常处理
- Thinking in Java——第十二章-通过异常处理错误
- Golang 错误和异常处理的正确姿势
- python的错误类型和异常处理
- 错误处理和异常处理,你用哪一个[转载]
- 用异常来处理错误----第三节 捕获和处理异常
- 【C++】错误处理和异常处理
- SURF角点检测出现错误:SURF.exe 中的 0x756ad36f 处未处理的异常: Microsoft C++ 异常: 内存位置 0x003fcaf0 处的 cv::Exception。
- 12 我读Thinking in java 通过异常处理错误
- Retrofit 使用flatmap操作符时处理错误、异常
- PHP的异常和错误处理
- Java学习-12.通过异常处理错误
- C错误异常处理,异常处理
- ORACLE 异常错误处理
- 关于两种错误处理方式(返回值,异常)的浅显认识
- Retrofit+RxJava 优雅的处理服务器返回异常、错误
- chapter12 -- 通过异常处理错误
- 开发常见错误解决(6)WSE3.0未处理的WebException,未处理的Web异常,基础连接以及关闭