Class: UploadField

UploadField

File control with nice custom styles.


new UploadField(container, data, options, schema, view, connector)

Parameters:
Name Type Description
container Object

Field container.

data Any

Field data.

options Object

Field options.

schema Object

Field schema.

view Object | String

Field view.

connector Alpaca.Connector

Field connector.

Source:

Extends

Methods


_validateMaxLength()

Validates against the schema maxLength property.

Inherited From:
Source:
Returns:

True if its size is less than maxLength , false otherwise.

Type
Boolean

_validateMinLength()

Validates against the schema minLength property.

Inherited From:
Source:
Returns:

True if its size is greater than minLength, false otherwise.

Type
Boolean

_validatePattern()

Validates against the schema pattern property.

Inherited From:
Source:
Returns:

True if it matches the pattern, false otherwise.

Type
Boolean

applyBindings(fileUpload)

Extension point for binding event handlers to file upload instance.

Parameters:
Name Type Description
fileUpload
Source:

applyConfiguration(fileUploadconfig)

Extension point for adding properties and callbacks to the file upload config.

Parameters:
Name Type Description
fileUploadconfig
Source:

convertDescriptorToFile(descriptor, callback)

Converts a storage descriptor to a file.

A file looks like:

 {
     "id": "",
     "name": "picture1.jpg",
     "size": 902604,
     "url": "http://example.org\/files\/picture1.jpg",
     "thumbnailUrl": "http://example.org\/files\/thumbnail\/picture1.jpg",
     "deleteUrl": "http://example.org\/files\/picture1.jpg",
     "deleteType": "DELETE"
 }

Since an underlying storage mechanism may be consulted, an async callback hook is provided.

By default, the descriptor mimics the file.

Parameters:
Name Type Description
descriptor
callback

function(err, file)

Source:

convertFileToDescriptor(file, callback)

Converts from a file to a storage descriptor.

A descriptor looks like:

 {
     "id": ""
     ...
 }

A descriptor may contain additional properties as needed by the underlying storage implementation
so as to retrieve metadata about the described file.

Assumption is that the underlying persistence mechanism may need to be consulted. Thus, this is async.

By default, the descriptor mimics the file.

Parameters:
Name Type Description
file
callback

function(err, descriptor)

Source:

destroy()

Inherited From:
Source:
See:

disable()

Source:
See:

enable()

Source:
See:

enhanceFiles(fileUploadConfig, row)

Extension point for "enhancing" data received from the remote server after uploads have been submitted.
This provides a place to convert the data.rows back into the format which the upload control expects.

Expected format:

data.result.rows = [{...}]
data.result.files = [{
"id": "",
"path": "",
"name": "picture1.jpg",
"size": 902604,
"url": "http://example.org\/files\/picture1.jpg",
"thumbnailUrl": "http://example.org\/files\/thumbnail\/picture1.jpg",
"deleteUrl": "http://example.org\/files\/picture1.jpg",
"deleteType": "DELETE"*
}]

Parameters:
Name Type Description
fileUploadConfig
row
Source:

focus()

Inherited From:
Source:
See:

getControlValue()

Overrides:
Source:
See:

getDescription()

Overrides:
Source:
See:
  • Alpaca.ControlField#getDescription

getDownloadTemplate()

Gets the download template.

Source:

getFieldType()

Overrides:
Source:
See:
  • Alpaca.ControlField#getFieldType

<private> getOptionsForOptions()

Inherited From:
Source:
See:

<private> getOptionsForSchema()

Inherited From:
Source:
See:

<private> getSchemaOfOptions()

Overrides:
Source:
See:

<private> getSchemaOfSchema()

Inherited From:
Source:
See:

getTitle()

Overrides:
Source:
See:
  • Alpaca.ControlField#getTitle

getType()

Overrides:
Source:
See:
  • Alpaca.ControlField#getType

getUploadTemplate()

Gets the upload template.

Source:

handleValidate()

Inherited From:
Source:
See:

onKeyPress()

Inherited From:
Source:
See:

postRender()

Inherited From:
Source:
See:

preload(fileUpload, el, callback)

Preloads data descriptors into files.

Parameters:
Name Type Description
fileUpload
el
callback
Source:

removeValue(id)

Removes a descriptor with the given id from the value set.

Parameters:
Name Type Description
id
Source:

setup()

Overrides:
Source:
See:

setValue()

Inherited From:
Overrides:
Source:
See: