Skip to content

Datatables serverside tips

DenisTDR edited this page Jan 29, 2021 · 1 revision

MCMS

Datatables Serverside Search

Simple One To Many

[TableColumn(DbColumn = "User.FirstName", DbFuncFormat = "MDbFunctions.Concat({0}, ' ', x.User.LastName)")]
public string UserDisplay => User?.ToString() ?? Id;

Simple Many To Many

public List<ParticipantViewModel> Participants { get; set; }

[TableColumn(DbColumn = "Participants",
        DbFuncFormat = "{0}.Any(p=> <condition>)<sel>MDbFunctions.Concat(p.User.FirstName, ' ', p.User.LastName)",
        Orderable = ServerClient.None)]

[DisplayName("Participants")]
public string ProjectsNames => string.Join(", ", Participants.Select(p => p.FullName);
Clone this wiki locally