Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Model

A data model class.

Hierarchy

  • Model

Index

Constructors

constructor

Properties

Protected _config

_config: ModelConfig

Protected _data

_data: JsonObject

Protected _isD

_isD: boolean = false

Static DEFAULT_FIELDS

DEFAULT_FIELDS: Array<FieldConfig | string> = []

子类定义的缺省字段集

Methods

Protected _addFields

Protected _fire

  • Parameters

    Returns void

addField

addFields

clear

  • clear(): this
  • Returns this

clone

  • clone(): this
  • Returns this

destroy

  • destroy(): void
  • Returns void

get

  • get(fieldName: string): any
  • Parameters

    • fieldName: string

    Returns any

getData

  • getData(): {}
  • Returns {}

    • [key: string]: T

getField

  • getField(name: string): Field
  • Parameters

    • name: string

    Returns Field

getFields

getId

  • getId(): any
  • Returns any

getIdField

hasField

  • hasField(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

iniData

  • iniData(): any
  • iniData(data: any): this
  • Returns any

  • Parameters

    • data: any

    Returns this

isDestroyed

  • isDestroyed(): boolean
  • Returns boolean

isEmpty

  • isEmpty(): boolean
  • Returns boolean

isIdField

  • isIdField(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

load

off

  • off(type?: string): this
  • Parameters

    • Optional type: string

    Returns this

on

  • on(type: string, fn: EventHandler<this>, once?: boolean): this
  • Parameters

    • type: string
    • fn: EventHandler<this>
    • Optional once: boolean

    Returns this

reload

removeField

  • removeField(name: string): this
  • Parameters

    • name: string

    Returns this

removeFields

  • removeFields(names: Array<string>): this
  • Parameters

    Returns this

reset

  • reset(): this
  • Returns this

set

  • set(key: string, value: any, equal?: boolean | ((this: this, newVal: any, oldVal: any) => boolean)): this
  • Parameters

    • key: string
    • value: any
    • Optional equal: boolean | ((this: this, newVal: any, oldVal: any) => boolean)

    Returns this

setData

  • setData(data: JsonObject, silent?: boolean): this
  • Parameters

    Returns this

setId

  • setId(id: number | string): this
  • Parameters

    • id: number | string

    Returns this

updateField

updateFields

validate

validateField

  • validateField(fieldName: string, value?: any, result?: ValidateResult): string | boolean
  • Parameters

    • fieldName: string
    • Optional value: any
    • Optional result: ValidateResult

    Returns string | boolean