ExtJs6 理解 -- Ext.data.proxy.Proxy
生活随笔
收集整理的這篇文章主要介紹了
ExtJs6 理解 -- Ext.data.proxy.Proxy
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
1、?Ext.data.proxy.Proxy 分類
Proxy 分為 client 和 Server 兩種
Client:
??? LocalStorageProxy? : 本地化級別代理(跨瀏覽器)存儲在本地,重啟瀏覽器服務器依然存在 -- 重點
??? SessionStorageProxy : 瀏覽器級別代理 -- 重點
????MemoryProxy : 普通內存代理 -- 重點
Server:
????Ajax : 異步加載 -- 重點
?? JsonP :? 跨域交互代理 -- 重點
????Rest : 一種特使的Ajax -- 知道
????Direct : 命令
2、Proxy 的 types
????localSorage,sessionstorage,memory ,ajax , jsonp,scripttag,rest,direct
舉個例子: ajax(常用),sessionstorage
//ajax Ext.onReady(function(){Ext.define('User',?{extend:?'Ext.data.Model',fields:?[{name:?'id',????type:?'int'},{name:?'name',??type:?'string'},{name:?'phone',?type:?'string',?mapping:?'phoneNumber'}]});var?store?=?Ext.create('Ext.data.Store',?{model:?'User',proxy:?{type:?'ajax',url:?'user.json',reader:?{type:?'json',rootProperty:?'users'}}});store.load();var?collection?=?store.getData(?)?;alert(collection)collection.each(function(item,index,len){alert(item.data.name)})}); //sessionstorage Ext.onReady(function(){Ext.define('User',?{extend:?'Ext.data.Model',fields:?[{name:?'id',????type:?'int'},{name:?'name',??type:?'string'},{name:?'phone',?type:?'string',?mapping:?'phoneNumber'}]});var?store?=?Ext.create('Ext.data.Store',?{model:?'User',proxy:?{type:?'localstorage',id??:?'twitter-Searches'}});store.add({name:"Mercy"});store.sync();store.load();store.each(function(item){alert(item.data.name);});alert(msg.join("\n"));});轉載于:https://my.oschina.net/mercyyang/blog/604170
總結
以上是生活随笔為你收集整理的ExtJs6 理解 -- Ext.data.proxy.Proxy的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android 学习笔记四:创建工具栏按
- 下一篇: LeetCode_Path Sum II