zoukankan      html  css  js  c++  java
  • Ext.data.DataWriter Example

    Ext.data.DataWriter Example

    This example shows how to implement a Writer for your Store. A Writer-enabled Store frees you from having to manually compose Ajax requests to perform CRUD actions on a Store.

    Note that the js is not minified so it is readable. See writer.js, UserForm.js and UserGrid.js.

    The HttpProxy plugged into the store in this example uses the new api configuration instead of an url. A simple MVC-like php backend has been created for this example which simulates a database by storing records in $_SESSION. See the file /remote/app/controllers/users.php. You may have to configure your web-server to allow scripts to be executed in the /examples directory.

    var proxy = new Ext.data.HttpProxy({    api: {        read    : 'app.php/users/read',        create  : 'app.php/users/create',        update  : 'app.php/users/update',        destroy : 'app.php/users/destroy'    }});

    Take note of the requests being generated in Firebug as you interact with the Grid and Form.

    An Error has been simulated on the server-side: Attempting to update a record having ODD-numbered id will generate this errror. Responses from the update action will have successProperty === false along with a message. This error can be handled by listening to the "exception" event upon your Store.

    exception : function(proxy, type, action, options, res, arg) {    if (type === 'remote') {        Ext.Msg.show({            title: 'REMOTE EXCEPTION',            msg: res.message,            icon: Ext.MessageBox.ERROR        });    }}

    Note: This new "exception" event supercedes the old loadexception event which is now deprecated.

    User -- All fields are required
    Users
       
       
       
     
       
       
       
     
    ID
    Email
    First
    Last
    1
    fred@flintstone.com
    Fred
    Flintstone
    2
    wilma@flintstone.com
    Wilma
    Flintstone
    3
    pebbles@flintstone.com
    Pebbles
    Flintstone
    4
    barney@rubble.com
    Barney
    Rubble
    5
    betty@rubble.com
    Betty
    Rubble
    6
    bambam@rubble.com
    BamBam
    Rubble
     
     
    @cfg:
     
       
       
       
     
       
       
       
     
       
       
       
     

    http://dev.sencha.com/deploy/dev/examples/writer/writer.html

  • 相关阅读:
    事件修饰符(.passive)
    vue中$nextTick函数(异步dom更新)
    使用ellipsis时的问题和控制文字n行显示(webkit-box方法)
    font-size 设为0 解决行内元素边距问题(空白字符带来的间距问题)
    Vue-eBookReader 学习笔记(阅读进度部分)
    Vue-eBookReader 学习笔记(阅读器解析和渲染部分)
    mysql 免密登录
    ansible 复制文件到本地 localhost
    对象存储测试工具 cosbench
    Mac 下安装 mongodb
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/1818703.html
Copyright © 2011-2022 走看看