Share this post on:

AutoViewGenerator

Auto-view generator generates content for views of Format ‘auto’.

AutoViewGenerator Properties

Name : String
Generator view full name.

IDE : String
Full name of a view to be used as a customization for IDE.

SupportsState : Boolean
Indicates that the generator supports property states.

AutoViewGenerator Methods

GetProperties(view, context?) : GeneratorProperty[]

Returns auto-view properties for rendering.

GetProperties Parameters

view : View

context? : Dict

GenerateView(view, context?)

Generates content for auto-view.

GenerateView Parameters

view : View

context? : Dict

GenerateProperty(property, view, context?, state?)

Generates property for auto-view.

GenerateProperty Parameters

property : ItemProperty

view : View

context? : Dict

state? : Dict

AdjustGeneratedProperty(property, generated, context?, ignoreState = false) : Dict

Fixes generated property object if needed.

AdjustGeneratedProperty Parameters

property : ItemProperty

generated : Dict

context? : Dict

ignoreState? : Boolean

GeneratorProperty

Auto views can contain both real and custom properties so view generator can return either one.

GeneratorProperty Properties

ItemProperty : ItemProperty
Real property.

VirtualProperty : Dict
Virtual property as a view state dictionary.

View

View is a piece of application that may be part of server-side logic (e.g. API), client-side logic (e.g. UI) or hybrid logic (e.g. templates, auto-views), depending on its type.

View Properties

Id : Integer

Name : String
Entity name.

Uid : String
Unique identifier of the view (Name is not unique).

FullName : String
Full name of the view in the form ‘{SolutionName}.{ItemTypeName}.{ViewName}’ or ‘{SolutionName}.{ViewName}’.

Type : String
View type defines its purpose.

  • Items
  • New
  • Update
  • Read
  • Custom
  • Override
  • Report
  • Print
  • Import
  • Template
  • Layout
  • EventHandler
  • Task
  • Generator

Format : String
View content format (e.g. gs, js, html, css, etc.).

Generator : String
AutoViewGenerator to use if the Format is ‘auto’.
Can be empty to use default solution generator (or global view generator if not set).

Internal : Boolean
Internal views are not accessible remotely and can be used server-side only.

Label : String
View label used by UI.

IconCls : String
Icon class used by UI.

Hidden : Boolean
Hidden views are not visible in UI and in documentation.

Order : Integer?
The view order defines its priority/order when multiple views match.

IsPersonal : Boolean
Personal views are views with single user permissions.

HasOverrides : Boolean
Indicates there are views of type ‘Override’ with the same name (used by UI to override some parts of the view content).

IsScript : Boolean
Indicates that the Format is ‘gs’ or ‘gsAction’.

IsAction : Boolean
Indicates that the Format is ‘gsAction’.

IsLayout : Boolean
Indicates that the Type is ‘Layout’.

IsEventHandler : Boolean
Indicates that the Type is ‘EventHandler’ and Format is ‘gsAction’.

TranslatedLabel : String
Label used by UI, translated to the current user’s language.

Solution : Solution
Target solution the view belongs to.

ItemType : ItemType
Target item type the view belongs to.

View Methods

GetOptions(excludeDynamic = false) : Dict

Returns view options (available only for Format ‘auto’).

GetOptions Parameters

excludeDynamic? : Boolean

GetOwnOption(name) : Result

Returns single option by name (available only for Format ‘auto’).

GetOwnOption Parameters

name : String

Option(name, defaultValue = missing, updateDynamic = false)

Returns single option by name, takes from base view if missing (available only for Format ‘auto’).

Option Parameters

name : String

defaultValue = missing

updateDynamic? : Boolean
If true, then option is updated according to defaultValue.

GetOverrides() : Dict

Returns options overrides that are applied to content after view generator on Render.

EditProperties() : Dict

Returns view properties for edit (e.g. by IDE).

Render(vars?)

Renders the view with specified variables.

Depending on the Format and the Type, the behavior of Render can be different.
If the Type is ‘Template’, the Gnosis Template is substituted first.
If the Format is ‘gs’ or ‘gsAction’, the Gnosis Script is executed.
If the Format is ‘gshtml’, the Gnosis Raw Template String is substituted.
If the Format is ‘auto’, the view’s AutoViewGenerator is used to generate content.
All textual formats except ‘gshtml’ support macros $include(viewName) to include other views content.

Render Parameters

vars? : Dict

IsSettingsView() : Boolean

Checks if the view contains settings (Format is ‘json’ or ‘settings’ and name is ‘Settings’).

GetCodeInfo() : CodeInfo

Returns code info for Gnosis Script views.

GetBase() : View

Returns the view with the same name and type from the base item type (null if not found).

IsAccessibleFor(identity) : Boolean

Checks if the view is accessible for the specified identity.

IsAccessibleFor Parameters

identity
Identity object, or team name, or user email.

IsAccessibleFor Examples

View('SomeSolution.SomeView').IsAccessibleFor('Everyone');

IsAccessible() : Boolean

Checks if the view is accessible for the current user.

IsAccessibleInState(state) : Boolean

Checks if the view is accessible in the specified state for the current user.

IsAccessibleInState Parameters

state : String

GetPermittedTeams(state?) : Identity[]

Returns teams that have permissions to the view in the specified state.

GetPermittedTeams Parameters

state? : String

GetGenerator() : AutoViewGenerator

Returns AutoViewGenerator for this view (works for views of Format ‘auto’).

GetProperties(options?) : ViewProperty[]

Returns rendered view properties.

GetProperties Parameters

options? : Dict
Options used by generators.

GetItemsData(items, requestOnlyProps?) : Dict[]

Serializes specified items according to the view options.

GetItemsData Parameters

items : []

requestOnlyProps? : []

ViewProperty

Rendered property wrapper that contains needed info for a view.

ViewProperty Properties

Name : String
Real property full name or virtual property name.

Property : ItemProperty
Real property reference (null for virtual view properties).

IsVirtual : Boolean
Indicates that the property is virtual (has no real property reference).

Sequence : Float
Sequence number of the view property to order properties.

Label : String
Property label.

Critical : Boolean
Indicates that the property data is critical to be transferred even if the property is hidden.

Hidden : Boolean
Indicates that the property is hidden.

Grouped : Boolean
Indicates that the property is being used for items grouping.

Transform : Function
Transform function for property display value.
For real property it is a function (value, item, viewProperty) => displayValue
For virtual property it is a function (item, viewProperty) => displayValue

FormatString : String
Format string to apply to a property display value.

CustomView : String
Custom view to use for reference property data.

Rendered : Dict
Rendered property state.

Share this post on:

Leave a Comment

Your email address will not be published. Required fields are marked *