Extjs學習筆記——Ext.data.JsonStore使用說明,ext.data.jsonstore

來源:互聯網
上載者:User

Extjs學習筆記——Ext.data.JsonStore使用說明,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指定,這裡指的是伺服器傳遞過來的json變數的命名
totalProperty:這裡指的是查詢出來的條數,也是由伺服器傳遞過來
fields(Object[]):對象數組集合
在實際應用中fields我們可以使用遍曆list等方式往裡面傳值。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.