欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

extjs DataReader、JsonReader、XmlReader的構(gòu)造方法

 更新時(shí)間:2009年11月07日 00:29:01   作者:  
DataReader、JsonReader、XmlReader的構(gòu)造方法,需要的朋友可以參考下。
extjs3.0幫助文檔:
DataReader( Object meta, Array/Object recordType )
Create a new DataReader
參數(shù):

meta : Object
Metadata configuration options (implementation-specific).
元數(shù)據(jù)配置選項(xiàng)(...-...)
recordType : Array/Object
Either an Array of Field definition objects
任意一個(gè)Field定義的對(duì)象數(shù)組
which will be passed to Ext.data.Record.create,
作為對(duì)象傳遞給Ext.data.Record.create,
or a Record constructor created using Ext.data.Record.create.
或一個(gè)由Ext.data.Record.create創(chuàng)建的Record結(jié)構(gòu).
返回:
void

內(nèi)部關(guān)鍵js代碼:
Ext.data.DataReader = function(meta, recordType){
this.meta = meta;
this.recordType = Ext.isArray(recordType) ?
Ext.data.Record.create(recordType) : recordType;
this.buildExtractors();
};
...略...
rs.id = data[this.meta.idProperty];
...略...
return (data && Ext.isObject(data) &&
!Ext.isEmpty(data[this.meta.idProperty])) ? true : false;

得出結(jié)論:
a.recordType可以直接是一個(gè)Field結(jié)構(gòu)的數(shù)組,由內(nèi)部代碼加上Ext.data.Record.create(...)。
b.recordType可以是已經(jīng)加上Ext.data.Record.create(...)的Field數(shù)組。
c.meta中可以放屬性:idProperty。




extjs3.0幫助文檔:
XmlReader( Object meta, Object recordType )
Create a new XmlReader.
參數(shù):
meta : Object
Metadata configuration options
recordType : Object
Either an Array of field definition objects as passed to Ext.data.Record.create,
任意一個(gè)field定義的對(duì)象數(shù)組作為參數(shù)傳遞給Ext.data.Record.create
or a Record constructor object created using Ext.data.Record.create.
或者一個(gè)使用Ext.data.Record.create創(chuàng)建的Record結(jié)構(gòu)對(duì)象。
返回:
void

可以看出需要傳兩個(gè)obj進(jìn)去,

查看內(nèi)部js代碼
Ext.data.JsonReader = function(meta, recordType){
//如果沒(méi)有meta,那創(chuàng)建一個(gè)Obj給meta。
meta = meta || {};
//把idProperty等添加到meta,如果它沒(méi)有這些成員。
Ext.applyIf(meta, {
idProperty: 'id',
successProperty: 'success',
totalProperty: 'total'
});
//調(diào)用父類
Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
...略...
var sid = this.meta.idPath || this.meta.id;
var totalRecords = 0, success = true;
if(this.meta.totalRecords){
totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);
}
if(this.meta.success){
var sv = q.selectValue(this.meta.success, root, true);
success = sv !== false && sv !== 'false';
}
可知:a.meta中可以有下列屬性:idProperty、successProperty、totalProperty、fields、idPath、id、totalRecords、success。
b.recordType可以為空,但要在meta中寫fields。
c.調(diào)用了父類構(gòu)造,所以其他的跟父類一樣。


extjs3.0幫助文檔:
JsonReader( Object meta, Array/Object recordType )
Create a new JsonReader
Create a new JsonReader
參數(shù):
meta : Object
Metadata configuration options.
recordType : Array/Object
Either an Array of Field definition objects
(which will be passed to Ext.data.Record.create,
or a Record constructor created from Ext.data.Record.create.
返回:
void

查看內(nèi)部js代碼:
Ext.data.JsonReader = function(meta, recordType){
meta = meta || {};
Ext.applyIf(meta, {
idProperty: 'id',
successProperty: 'success',
totalProperty: 'total' });
Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
};
...略...
if (Ext.isEmpty(o[this.meta.root])) {
throw new Ext.data.JsonReader.Error('root-emtpy', this.meta.root);
}
else if (o[this.meta.root] === undefined) {
throw new Ext.data.JsonReader.Error('root-undefined-response', this.meta.root);
}

可知:a.meta中可以有下列屬性:idProperty、successProperty、totalProperty、root、fields
b.recordType可以為空,但要在meta中寫fields。
c.調(diào)用了父類構(gòu)造,所以其他的跟父類一樣

總結(jié):...

相關(guān)文章

  • Extjs4 GridPanel 的幾種樣式使用介紹

    Extjs4 GridPanel 的幾種樣式使用介紹

    接下來(lái)為大家介紹下GridPanel的幾種樣式及選擇模式分類介紹,感興趣的朋友可以參考下哈
    2013-04-04
  • ExtJS中文亂碼之GBK格式編碼解決方案及代碼

    ExtJS中文亂碼之GBK格式編碼解決方案及代碼

    這幾天做后臺(tái)看了一些Ext的知識(shí),在切入工作項(xiàng)目的時(shí)候出現(xiàn)了亂碼情況,所以就總結(jié)了這篇ExtJS中文亂碼之GBK格式編碼解決辦法的文章,遇到此問(wèn)題的朋友可以參考一下,希望本文對(duì)你有所幫助
    2013-01-01
  • extjs 學(xué)習(xí)筆記 四 帶分頁(yè)的grid

    extjs 學(xué)習(xí)筆記 四 帶分頁(yè)的grid

    很多時(shí)候,我們需要顯示在grid中的數(shù)據(jù)不是短短的幾條或者幾十條,而是成千上萬(wàn)條。如果讓大量的數(shù)據(jù)一股腦全都顯示在一個(gè)頁(yè)面中,可以想象會(huì)造成什么樣的用戶體驗(yàn)。
    2009-10-10
  • ExtJS TabPanel beforeremove beforeclose使用說(shuō)明

    ExtJS TabPanel beforeremove beforeclose使用說(shuō)明

    ExtJS 關(guān)閉TabPanel內(nèi)的Panel時(shí)使用TabPanel的'beforeremove’和其內(nèi)的Panel的'beforeclose’事件彈出關(guān)閉確認(rèn)提示對(duì)話框
    2010-03-03
  • Extjs中常用表單介紹與應(yīng)用

    Extjs中常用表單介紹與應(yīng)用

    知道表單面板如何創(chuàng)建 了解表單面板中xtype的類型的應(yīng)用 知道表單面板如何驗(yàn)證,綁定,取值 綜合應(yīng)用表單面板(玩轉(zhuǎn)它)
    2010-06-06
  • Extjs 4.x 得到form CheckBox 復(fù)選框的值

    Extjs 4.x 得到form CheckBox 復(fù)選框的值

    CheckBox(復(fù)選框)主要用來(lái)接收用戶選擇的選項(xiàng),那么如何通過(guò)Extjs 4.x 得到form CheckBox的值呢?下面有個(gè)不錯(cuò)的方法,大家值得一看
    2014-05-05
  • ExtJs擴(kuò)展之GroupPropertyGrid代碼

    ExtJs擴(kuò)展之GroupPropertyGrid代碼

    這幾天做一個(gè)Web項(xiàng)目,使用了ExtJs,其中有個(gè)像設(shè)計(jì)器一樣的界面,選擇界面上的內(nèi)容,可以直接編輯內(nèi)容的屬性,這個(gè)原本來(lái)說(shuō)對(duì)于使用ExtJs還是很簡(jiǎn)單的。
    2010-03-03
  • extjs 列表框(multiselect)的動(dòng)態(tài)添加列表項(xiàng)的方法

    extjs 列表框(multiselect)的動(dòng)態(tài)添加列表項(xiàng)的方法

    最近公司一個(gè)項(xiàng)目,因?yàn)橐褂胐iv模擬的窗口,因?yàn)榫寐別xtjs的大名,因此就想在項(xiàng)目中使用一下.首先下載了multiselect的extjs3.0 demo.看到的代碼這里我就不粘貼了.
    2009-07-07
  • Extjs4.0設(shè)置Ext.data.Store傳參的請(qǐng)求方式(默認(rèn)為GET)

    Extjs4.0設(shè)置Ext.data.Store傳參的請(qǐng)求方式(默認(rèn)為GET)

    本教程將詳細(xì)介紹下設(shè)置Ext.data.Store傳參的請(qǐng)求方式;亮點(diǎn),設(shè)置請(qǐng)求方式,默認(rèn)為GET,感興趣的朋友可以參考下哈
    2013-04-04
  • ExtJS下 Ext.Direct加載和提交過(guò)程排錯(cuò)小結(jié)

    ExtJS下 Ext.Direct加載和提交過(guò)程排錯(cuò)小結(jié)

    基礎(chǔ)夯實(shí)一點(diǎn),會(huì)有好處的,排錯(cuò)的時(shí)候就體現(xiàn)出來(lái)了,下面就Ext.Direct做一些排錯(cuò)筆記與大家一一分享,感興趣的朋友可以參考下哈
    2013-04-04

最新評(píng)論