ListItemAccessor class

When a field customizer extension is rendering a field, the ListItemAccessor provides access to the associated SharePoint list item.

Remarks

ListItemAccessor allows a field customizer extension to determine which fields are available in the editor and retrieve the current values for those fields. In the future, it may also support validation and editing operations.

When the editor is the SharePoint list view, the ListViewAccessor uses the RowAccessor subclass instead of the ListItemAccessor base class. This allows additional functionality to be exposed, for example determining whether the associated table row is selected or not.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ListItemAccessor class.

Properties

fields

The SharePoint fields that are currently available in the editor for this list item.

Methods

getValue(field)

Retrieves the current data value for the specified field. The value will be a primitive JavaScript object such as a string, number, etc.

getValueByName(internalName)

Retrieves the current data value for the field with the specified internal name. The value will be a primitive JavaScript object such as a string, number, etc.

Property Details

fields

The SharePoint fields that are currently available in the editor for this list item.

abstract get fields(): ReadonlyArray<SPField>;

Property Value

ReadonlyArray<SPField>

Remarks

The set of available fields depends on the editing context. For example, if a list view column is hidden, the corresponding field definition may not be loaded. Field customizers should not assume that a given field will be available, even if it is defined in the content type.

Method Details

getValue(field)

Retrieves the current data value for the specified field. The value will be a primitive JavaScript object such as a string, number, etc.

abstract getValue(field: SPField): any;

Parameters

field
SPField

Returns

any

getValueByName(internalName)

Retrieves the current data value for the field with the specified internal name. The value will be a primitive JavaScript object such as a string, number, etc.

abstract getValueByName(internalName: string): any;

Parameters

internalName

string

Returns

any