`
yufenfei
  • 浏览: 796563 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ExtJS---Ext.data.Store之错误处理

阅读更多

原先的Ext.data.Store一直没有进行错误处理。今天考虑一下,其实很简单

先来看看Store的load()方法

loadObject 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('提示,'数据提取成功)   

                      }
              }
     });

分享到:
评论

相关推荐

    Extjs 继承Ext.data.Store不起作用原因分析及解决

    关于这个原因有很多种,我只说下我遇到的 我这样 写Store来复用的 代码如下: DocStore = Ext.extend(Ext.data.Store,{ initComponent:function(){ this.proxy = new Ext.data.HttpProxy({url:this.url}); this....

    extJs 2.1学习笔记

    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学习笔记,共30讲

    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 + 笔记 + 完整包

    ExtJs + api + 笔记 + 完整包

    Extjs4.0设置Ext.data.Store传参的请求方式(默认为GET)

    代码如下: var Store = Ext.create(‘Ext.data.Store’, { pageSize: pageSize, model: ‘Ext.data.Model名称’, autoLoad: false, proxy: { type: ‘ajax’, url: ‘请求路径’, getMethod: function(){ return ...

    ExtJS入门教程(超级详细)

    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框架.part2.rar

    《精通JS脚本之ExtJS框架》由浅入深地讲解了ExtJS在Web开发中的相关技术。本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计...

    Ext Js权威指南(.zip.001

    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框架.part1.rar

    《精通JS脚本之ExtJS框架》由浅入深地讲解了ExtJS在Web开发中的相关技术。本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计...

    extjs4 对各类型store各种数据的读取 model 前台 等等

    extjs4 对多种store数据 ,以多种方式绑定到界面上,以一例子以说明编写

    ExtJS6.5.0+SSM表格增删改查+分页

    1.使用ExtJS6.5.0+SSM 2.实现Grid表格的增删改查和分页,数据库使用的是MySql, 3.项目代码和数据脚本齐全 4.Jar齐全,加载即可运行 5.VX:humingxing可随时交流

    Extjs exporter

    导出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 ...

    ext js解析xml文档

    Extjs解析xml问题 ... var store=new Ext.data.Store({   url:'GridData.xml',  reader:new Ext.data.XmlReader(  {record:'Item'},   ["ASIN","Author","Manufacturer","ProductGroup","Title"])  });

    SenchaCmd-3.1.0.192-windows.exe

    需要注意的是,生成的EXTjs 是商业体验版本,如果你购买了,那么你需要下载ext js的zip包,并且使用-SDK命令来制定SDK的路径,这样,就不会去默认下载SDK而是按照你本地的文件来生成了。 命令如下: sencha -sdk /...

    extJs 下拉框联动实现代码

    代码如下:// 第一个下拉框 var parentStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: ‘loadByParentid.action?parentid=1001’ }), reader: new Ext.data.JsonReader({ root: ‘list’, id: ...

    Ext JS in Action, 2nd Edition

    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: ...

    轻松搞定Extjs_原创

    四、Ext.data.Store类 59 五、下拉列表框 60 六、得到下拉列表框的值 62 七、源代码 63 八、小结 64 第十一章:Ajax与ComboBox 65 一、Ajax 65 二、Ext.Ajax类 65 三、Ajax文件上传 67 四、你来自远方 72 五、小结 ...

Global site tag (gtag.js) - Google Analytics