-
-
Save mdfarragher/d5059f8f4be673e133c8f53bd097052a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Html; | |
Formatter<DataDebuggerPreview>.Register((preview, writer) => | |
{ | |
var headers = new List<IHtmlContent>(); | |
headers.Add(th(i("index"))); | |
headers.AddRange(preview.ColumnView.Select(c => (IHtmlContent) th(c.Column.Name))); | |
var rows = new List<List<IHtmlContent>>(); | |
var count = 0; | |
foreach (var row in preview.RowView) | |
{ | |
var cells = new List<IHtmlContent>(); | |
cells.Add(td(count)); | |
foreach (var obj in row.Values) | |
{ | |
cells.Add(td(obj.Value)); | |
} | |
rows.Add(cells); | |
count++; | |
} | |
var t = table( | |
thead( | |
headers), | |
tbody( | |
rows.Select( | |
r => tr(r)))); | |
writer.Write(t); | |
}, "text/html"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment