Custom Grid Code

Anything created with the Custom Grid Auto-Code Designer is capable of having that design exported into actual c# code for you to add to you own .net library that can be loaded as an Add-In [see more] in LemonEdge.

Code

The Auto-Code designer will export the following:

  • The definition of the grid itself
    • You can modify any part of this class
  • The list of all columns in the grid along with any of their custom behaviour/formatting
    • You can modify this column list

See our API-Code section for more information about using our API to create you own grids and other UI components.


Example

As a simple example, continuing our Insurance mock entity from the Custom Entity example [more info] we could create a simple grid that holds the name and currency 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 ContractsGridController : BaseGridController
	{

		public ContractsGridController(IBaseGrid view) : base(view) { }

		protected override IEnumerable ColumnNames() =>
			new ControlDisplayInfoLight[]
			{
				new ControlDisplayInfoLight(nameof(IInsuranceContract.Name), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Name", AggregateFunction = LemonEdge.Utils.Database.AggregateFunction.None, Format = "", Visible = true, GroupKey = "" },
				new ControlDisplayInfoLight(nameof(IInsuranceContract.CurrencyID), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Currency", AggregateFunction = LemonEdge.Utils.Database.AggregateFunction.None, Format = "", Visible = true, GroupKey = "" },
			};

		public override bool AutoOpenNewItemInTab => true;
		public override bool AllowOpenCommand => true;

	}



}
  

See our API-Code section for more information about using our API to create you own grids and other UI components.