Custom Views
Custom Views allow you to quickly create views in the UI for any entity in the system. This includes system entities, custom entities and entities you have created with AddIns using our API as all entities whether system or designed are the same. You can use your custom view in any custom layouts or override system views with your own view.
Code
The Auto-Code designer will export the following:
- The definition of the view itself
- You can modify any part of this class
- The list of all controls in the view along with any custom behaviour/formatting.
- You can modify this control list
Note
See our API-Code section for more information about using our API to create you own views and other UI components.
Example
As a simple example, continuing our Insurance Contract mock entity from the Custom Entity example more info we could create a simple view that holds the name, currency and description of our mock insurance contracts. The system would create the following code for us:
/*
Auto Generated file by LemonEdge © 2020
Warning: Any changes to this file will be overwritten if it is regenerated.
*/
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Text;
using LemonEdge.Entities;
using LemonEdge.API.Core;
using LemonEdge.API.Entities;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
using LemonEdge.Core;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Runtime.Serialization;
using LemonEdge.API.Attributes;
using LemonEdge.Client.Core.Views.Core;
namespace LemonEdge.Client.Views
{
public class ContractViewController : BaseDefaultSingleViewController
{
public ContractViewController(IBaseDefaultSingleView view) : base(view) { }
protected override IEnumerable ControlNames() =>
new ControlDisplayInfoLight[]
{
new ControlDisplayInfoLight(nameof(IInsuranceContract.Name), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Name", Format = "", Visible = true },
new ControlDisplayInfoLight(nameof(IInsuranceContract.CurrencyID), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Currency", Format = "", Visible = true },
new ControlDisplayInfoLight(nameof(IInsuranceContract.Description), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Description", Format = "", Visible = true },
};
}
}
Note
See our API-Code section for more information about using our API to create you own views and other UI components.