Documentation

BX.UI.UserField

Description

Extension contains class for custom user field settings model.

This model is used:

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

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. Only id can be passed and then call the method load()
  • params - additional parameters object
    • moduleId - module ID. Required for handling AJAX-actions for saving/updating settings
    • languageId - language ID. When not passed, uses current language interface

Ajax-methods

Method Description Available from version
load(): Promise<UserField,string[]> Method executes AJAX-query with attempts to load actual data on user field settings. Updates settings data on success.

Returns Promise. reject retrieves array with error messages

save(): Promise<UserField,string[]> Executes ajax-query with attempt to save user field settings. Automatically determines, to add (when id is not specified) or update.

Returns Promise. reject receives array with error messages

delete(): Promise<UserField,string[]> Executes AJAX-query with attempt to delete user field settings. Marks as deleted on success (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 changed at saved field
  • getEntityId(): string
  • getUserTypeId(): string
  • setUserTypeId(userTypeId: string): this - Not changed at saved field
  • isMultiple(): boolean
  • setIsMultiple(isMultiple: boolean|string): this - Not changed at saved field
  • isMandatory(): boolean
  • setIsMandatory(mandatory: boolean): this
  • getDetailUrl(): ?string
  • isDeleted(): boolean - Returns true, when field was deleted via method delete()
  • getEnumeration(): ?Array - Returns array with value variants for the "List" property type
  • setEnumeration(items: Array): this - Sets value variants for "List" property type
  • getTitle(): string
  • setTitle(title: string, languageId: ?string): this
  • setData(data: UserFieldData): this - Sets data on field settings
  • getData(): UserFieldData - Returns data on field settings

Serialization

In some cases, you have a scenario when you need to pass object between several windows when field settings are opened and updated in slider. After this, object must be located at parent page.

However, you cannot fully and correctly pass object from one window to another, that's why object must be serialized in a single window, and in the other window - restored from string.

serialize(): string - returns string with serialized object data

static unserialize(serializedData: string): UserField - allows to restore object from serialized string


© «Bitrix24», 2001-2024
Up