ExtJSノートExt.data.Types

9803 ワード

This is a static class containing the system-supplied data types which may be given to a  Field .
Typesは、Fieldで使用されるシステムが提供するデータ型を含む静的クラスです.
The properties in this class are used as type indicators in the  Field  class, so to test whether a Field is of a certain type, compare the  type  property against properties of this class.
このような属性はFieldのタイプインジケータとして使用されるため、フィールドに特定のタイプがあるかどうかをテストする場合は、そのtype属性をTypesクラスの属性と比較できます.
Developers may add their own application-specific data types to this class. Definition names must be UPPERCASE. Each type definition must contain three properties:
開発者は、このクラスにカスタムタイプを追加できます.名前は大文字でなければなりません.各タイプ定義には、次の3つの属性が必要です.
  • convert:Function変換関数A function to convert raw data values from a data block into the data to be stored in the Field.The function is passed the collowing parameters:この関数は、データブロック内の元のデータをFieldフィールドに転送します.関数は2つのパラメータに入力されます.
  • v : MixedThe data value as read by the Reader, if undefined will use the configured  defaultValue . readerによって読み出すデータは、定義されていない場合はdefaultValue
  • を用いる.
  • rec : MixedThe data object containing the row as read by the Reader. Depending on the Reader type, this could be an Array ( ArrayReader ), an object ( JsonReader ), or an XML element. readerが読み込んだ現在の行データオブジェクト.readerのタイプに依存します.これは配列(ArrayReader)、オブジェクト(JsonReader)、またはxml要素です.

  • sortType:FunctionソートタイプA function to convert the stored data into comparable form,as defined by Ext.data.SortTypes.データを比較可能な形式に変換する関数で、詳細はExt.data.SortTypesを参照する.
  • type:StringタイプA textual data type name.テキスト形式のタイプ名.

  • For example, to create a VELatLong field (See the Microsoft Bing Mapping API) containing the latitude/longitude value of a datapoint on a map from a JsonReader data block
    which contained the properties  lat  and  long , you would define a new data type like this:
    たとえば、地図上のデータポイントの経度/次元値を含むVELatLongフィールド(Microsoft Bing Mapping API参照)を作成します.データはJsonReaderのデータブロックから来て、latとlong属性が含まれています.これにより、次のような新しいデータ型を定義できます.
    // Add a new Field data type which stores a VELatLong object in the Record.
    Ext.data.Types.VELATLONG = {
        convert: function(v, data) {
            return new VELatLong(data.lat, data.long);
        },
        sortType: function(v) {
            return v.Latitude;  // When sorting, order by latitude
        },
        type: 'VELatLong'
    };

     
    Then, when declaring a Model, use:
    次に、次のモデルを定義します.
    var types = Ext.data.Types; // allow shorthand type access
    Ext.define('Unit',
        extend: 'Ext.data.Model',
        fields: [
            { name: 'unitName', mapping: 'UnitName' },
            { name: 'curSpeed', mapping: 'CurSpeed', type: types.INT },
            { name: 'latitude', mapping: 'lat', type: types.FLOAT },
            { name: 'longitude', mapping: 'long', type: types.FLOAT },
            { name: 'position', type: types.VELATLONG }
        ]
    });

     

    データ型


     : 
    Object
    This data type means that no conversion is applied to the raw data before it is placed into a Record.変換は発生しません


     : 
    Object
    This data type means that the raw data is converted into a boolean before it is placed into a Record. ...   
     
     : 
    Object
    This data type means that the raw data is converted into a boolean before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into a Date before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into a number before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into an integer before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into an integer before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into a number before it is placed into a Record. ...
     
     : 
    Object
    This data type means that the raw data is converted into a String before it is placed into a Record.
     
     : 
    RegExp
    A regular expression for stripping non-numeric characters from a numeric value. ...