zoukankan      html  css  js  c++  java
  • 20. Extjs学习笔记——Ext.data.JsonStore使用说明

    Ext.data.JsonStore继承于Ext.data.Store,使得从远程JSON数据创建stores更为方便的简单辅助类。JsonStore合成了Ext.data.HttpProxy与Ext.data.JsonReader两者。如果你需要其他类型的proxy或reader组合,那么你要创建以Ext.data.Store为基类的配置。
    代码实例:

    1
    2
    3
    4
    5
    6
    7
    <code class="hljs lasso">var store = new Ext.data.JsonStore({
        id:'id',
        url: 'get-images.php',
        root: 'images',
        totalProperty: 'rowCount',
        fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
    });</code>
    他的返回值将形成如下的对象:
    1
    2
    3
    4
    5
    6
    7
    <code class="hljs css">
    {
        images: [
            {name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
            {name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
        ]
    }</code>

    下面我们依次说明下几个参数的含义:
    id(String):用来唯一标识
    url(String):如果有值传入,会为该URL创建一个HttpProxy对象
    root(String):JSON对象的key指定,这里指的是服务器传递过来的json变量的命名
    totalProperty:这里指的是查询出来的条数,也是由服务器传递过来
    fields(Object[]):对象数组集合
    在实际应用中fields我们可以使用遍历list等方式往里面传值。

  • 相关阅读:
    容斥原理
    m元集A到n元集B的满射的个数
    二项式反演公式
    多项式定理
    组合数的基本性质
    Luogu P2408 不同子串个数
    Luogu P5410【模板】扩展 KMP
    Luogu P2336 [SCOI2012]喵星球上的点名
    Luogu P2852 [USACO06DEC]牛奶模式Milk Patterns
    Luogu P4248 [AHOI2013]差异
  • 原文地址:https://www.cnblogs.com/sharpest/p/7561980.html
Copyright © 2011-2022 走看看