Documentation

BX.UI.UserField

Description

Extension contains class for user field settings model.

Model is used in:

Constructor receives the object UserFieldData with structure, returned by settings controller methods:

declare type UserFieldData = {
	id: ?number,
	fieldName: string,
	detailUrl: ?string,
	enum: ?Array,
	entityId: string,
	xmlId: ?string,
	sort: number,
	mandatory: string,
	showFilter: string,
	isSearchable: string,
	settings: ?{},
};

Methods

Method Description Available from version
constructor(data: UserFieldData, params: ?{}) Constructor. Parameters:
  • data - object of structure UserFieldData. Can pass only id, and then call the method load()
  • params - additional parameter object
    • moduleId - module identifier. Needed for ajax-actions for saving/updating settings
    • languageId - language ID. When not passed, uses the current interface language

Ajax methods

Method Description Available from version
load(): Promise<UserField,string[]> Executes ajax query with attempt to upload actual data about user field setting. On success, settings data is updated automatically.

Method returns Promise. reject receives array with error messages

save(): Promise<UserField,string[]> Executes ajax query with attempt to save user field settings. Automatically defines, what must be executed - adding (when id is not specified) or updating.

Returns Promise. reject receives array with error messages

delete(): Promise<UserField,string[]> Executes ajax query with attempt to delete user field settings. On success, field is marked as deleted (method isDeleted() returns true).

Returns Promise. reject receives array with error messages

Getters and setters


  • setLanguageId(languageId: string): this
  • getLanguageId(): string
  • setModuleId(moduleId: string): this
  • getId(): number
  • getName(): ?string
  • setName(name: string): this - not updated for a saved field
  • getEntityId(): string
  • getUserTypeId(): string
  • setUserTypeId(userTypeId: string): this - not updated for a saved field
  • isMultiple(): boolean
  • setIsMultiple(isMultiple: boolean|string): this - not updated for a saved field
  • isMandatory(): boolean
  • setIsMandatory(mandatory: boolean): this
  • getDetailUrl(): ?string
  • isDeleted(): boolean - Returns true, when field was deleted via the method delete()
  • getEnumeration(): ?Array - Returns array with value options for the "List" property type
  • setEnumeration(items: Array): this - Sets value variants for the "List" property type;
  • getTitle(): string
  • setTitle(title: string, languageId: ?string): this
  • setData(data: UserFieldData): this - Sets field settings data
  • getData(): UserFieldData - Returns field settings data

Serialization

In some cases, you must pass the object between several windows, when field settings are opened and updated in slider and then the same object must go to the parent page.

Full object cannot be passed correctly from one window to another, that is why, object must be serialized in one window, and restored from string in another.

serialize(): string - method returns string with serialized objet data

static unserialize(serializedData: string): UserField - Allows restoring object from serialized string



© «Bitrix24», 2001-2024
Up