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

    Ext.data.JsonStore继承于Ext.data.Store。使得从远程JSON数据创建stores更为方便的简单辅助类。

    JsonStore合成了Ext.data.HttpProxy与Ext.data.JsonReader两者。假设你须要其它类型的proxy或reader组合,那么你要创建以Ext.data.Store为基类的配置。


    代码实例:

    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'}]
    });

    他的返回值将形成例如以下的对象:

    
    {
        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)} ] }

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

  • 相关阅读:
    设计模式—享元模式
    设计模式—观察者模式
    设计模式—桥接模式
    设计模式—代理模式
    设计模式—装饰模式
    设计模式—单例模式
    设计模式—建造者模式
    设计模式—简单工厂
    源码解读—HashTable
    源码解读—HashMap
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/7257313.html
Copyright © 2011-2022 走看看