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:
|
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 | |
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 | |
delete(): Promise<UserField,string[]> | Executes AJAX-query with attempt to delete user field settings. Marks as deleted on success (method isDeleted() returns true ).
Returns |
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
- Returnstrue
, when field was deleted via methoddelete()
-
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