Skip to main content

Application configuration

This page covers global application configuration: display name, environment, logos, button behavior, field reset, About page, default HTTP format, and global LgGridView options.

Application name​

By default, the application name matches the Client project name without the .Client suffix. To customize it, set the App:Name key in the Server project's appsettings.json.

appsettings.json
{
"App": {
"Name": "My Lagoon App"
}
}

Environment displayed in the header​

The header's environment banner uses the App:EnvironmentName or App:EnvironmentDisplayName keys, and App:EnvironmentColor.

appsettings.json
{
"App": {
"EnvironmentName": "RECETTE",
"EnvironmentDisplayName": "Recette",
"EnvironmentColor": "#195E75"
}
}

The main logo is configured in the client project's styles with the SCSS variable $header-logo.

Client/resources/styles/main.scss
$header-logo: "~/images/header-logo.png";

The logo displayed on the right side of the header is configured with $toolbar-logo.

Client/resources/styles/main.scss
$toolbar-logo: "~/images/toolbar-logo.png";

Page display mode​

Single-page mode replaces the active page on navigation. Tabbed mode is enabled with IsTabbed="true" on LgApp.

App.razor
<LgApp DefaultLayout="typeof(PageLayout)" IsTabbed="true" ShowHeader="true">
<StartupTabs>
<LgStartupTab Link="Pages.Index.Link()" />
</StartupTabs>
<ChildContent>
<MenuConfiguration />
</ChildContent>
</LgApp>

Global behaviors in OnConfigureBehavior​

Client-side configuration is done in Client/Main.cs by overriding OnConfigureBehavior(ApplicationBehavior app).

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Sets the default size of buttons in application toolbars.
app.ToolbarButtonSize = ButtonSize.Medium;
app.FrameToolbarButtonSize = ButtonSize.Small;
app.ActionPanelToolbarButtonSize = ButtonSize.Large;
}
}

Reset button for inputs and selects​

The global configuration of the field reset button is applied via app.ResetButton. Dropdown list configuration is done via app.Select and can reuse or specialize these values.

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Hides the reset button on input fields.
app.ResetButton.HideAlwaysResetButton = true;
app.ResetButton.ResetText = "#reset";
app.ResetButton.ResetTextAriaLabel = "#resetAriaLabel";

// Specializes the reset text for LgSelect and LgSelectMultiple.
app.Select.ResetText = "#resetSelection";
}
}

About page​

Additional information​

Add additional information in the App:About:AdditionalInformation section.

appsettings.json
{
"App": {
"About": {
"AdditionalInformation": [
{
"Label": "#aboutSupportLabel",
"Description": "support@example.com",
"Uri": "mailto:support@example.com"
}
]
}
}
}

AdditionalInformation is an array: you can add multiple entries.

OwnerLogoUri displays the owner's main logo on the About page.

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Displays the customer's logo on the About page.
app.OwnerLogoUri = "_content/MyCompany/logo.png";
}
}

Developer logos​

DevelopedByLogoUri displays the logos in the Developed by area.

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Displays several contributor logos on the About page.
app.DevelopedByLogoUri = new List<string>
{
"_content/MyCompany/logo1.png",
"_content/MyCompany/logo2.png"
};
}
}

Default HTTP format​

The Lagoon client can request MessagePack or JSON. The default behavior is driven by DefaultAcceptHeader.

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Uses MessagePack for compatible HTTP exchanges.
app.DefaultAcceptHeader = DefaultAcceptHeader.MessagePack;
}
}

Global LgGridView options​

Some LgGridView options can be changed globally in OnConfigureBehavior. They then apply to every grid displayed by the application, unless overridden locally.

Main.cs
public class Main : LgCustomApplication
{
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Configures behaviors common to all grids.
app.GridView(options =>
{
options.ExportWithFilters = true;
options.ProfileStorageMode = GridViewProfileStorage.Remote;
options.SharedProfileAdministratorPolicy = "!*";
options.DisplayDefaultTooltipHeader = false;
options.ShowSummaryFilters = true;
});
}
}

List of reviewed options​

OptionRole
AddItemOnTopDisplays the add row at the top.
DefaultPageSizeDefault number of rows per page.
DisplayDefaultTooltipHeaderForces the display of tooltips on headers.
DisplayInputPageSelectorDisplays the page selector as an input field.
DisplaySuccessSaveMessageDisplays a success message after editing a cell.
ExportableEnables grid export.
ExportDisplayedColumnsExports only the displayed columns.
ExportWithFiltersExports with active filters by default.
MaxSortedColumnsMaximum number of sorted columns at the same time (4 by default, 0: no limit; a negative value raises ArgumentOutOfRangeException). Overridden by the grid's MaxSortedColumns parameter.
PagerOnTopDisplays the pager at the top of the grid.
PaginationSizeSelectorDefines the available page sizes.
ProfileStorageModeDefines profile storage: Local or Remote.
SharedProfileAdministratorPolicyPolicy allowing administration of shared profiles.
ShowSummaryFiltersDisplays the filter summary.
TooltipPositionDefault position of tooltips.
ProfileSaveModeDefines the profile save mode.
ProfileFeaturesElements saved in profiles and reloaded from them (GridFeature: Filter, Sort, Move, Visibility, Freeze, Resize, Group, Paging; all by default, other flags are ignored; Move and Freeze go together). Overridden by the grid's ProfileFeatures parameter.
ExportConfigurationGroups export options.
ResetInputConfigurationConfigures the grid filter reset button.

See also​