Dynamic columns

GridControl

Rows as property bags and columns read from their keys: a grid whose shape follows the data.

Overview

The grid reads a cell through the column's Field. When a row is an IDictionary<string, object>, which is what ExpandoObject is, Field is the key, so ad-hoc query results bind without a model class. On this page the columns come from the data too: a @foreach over the keys of the first row declares one GridColumn per key, numeric values get ColumnType.Number and a format, and when the key set changes the swap runs inside SuspendRedraw so the grid converges the columns in place.

Examples

#Columns read from the first row

Five keys per row to start. Turn on the lead-time field and every row gains a key, so a sixth column appears; turn it off and the column goes. Change the row count to rebuild the list at a different size. Sorting, the filter icons and the search box work on the dynamic values; the line under the grid lists the columns the grid has right now.

Example
Razor
C#
Code Description Group Status Rate
IT-1001Catalog item 1, architecturalArchitecturalActive134.91
IT-1002Catalog item 2, structuralStructuralActive258.84
IT-1003Catalog item 3, mepMEPActive73.09
IT-1004Catalog item 4, siteSitePending94.38
IT-1005Catalog item 5, generalGeneralActive29.44
IT-1006Catalog item 6, architecturalArchitecturalActive175.82
IT-1007Catalog item 7, structuralStructuralActive157.29
IT-1008Catalog item 8, mepMEPPending28.71
IT-1009Catalog item 9, siteSiteActive215.49
IT-1010Catalog item 10, generalGeneralActive158.75
IT-1011Catalog item 11, architecturalArchitecturalActive223.02
IT-1012Catalog item 12, structuralStructuralPending121.65
IT-1013Catalog item 13, mepMEPActive130.62
IT-1014Catalog item 14, siteSiteActive40.89
IT-1015Catalog item 15, generalGeneralActive140.15
IT-1016Catalog item 16, architecturalArchitecturalPending114.75
IT-1017Catalog item 17, structuralStructuralActive265.53
IT-1018Catalog item 18, mepMEPActive43.83
IT-1019Catalog item 19, siteSiteActive61.51
IT-1020Catalog item 20, generalGeneralPending172.72
IT-1021Catalog item 21, architecturalArchitecturalActive51.20
IT-1022Catalog item 22, structuralStructuralActive105.39
IT-1023Catalog item 23, mepMEPActive91.79
IT-1024Catalog item 24, siteSitePending81.66
IT-1025Catalog item 25, generalGeneralActive42.56
IT-1026Catalog item 26, architecturalArchitecturalActive245.34
IT-1027Catalog item 27, structuralStructuralActive75.27
IT-1028Catalog item 28, mepMEPPending211.51
IT-1029Catalog item 29, siteSiteActive204.63
IT-1030Catalog item 30, generalGeneralActive113.97
IT-1031Catalog item 31, architecturalArchitecturalActive142.98
IT-1032Catalog item 32, structuralStructuralPending255.18
IT-1033Catalog item 33, mepMEPActive123.50
IT-1034Catalog item 34, siteSiteActive111.86
IT-1035Catalog item 35, generalGeneralActive231.88
IT-1036Catalog item 36, architecturalArchitecturalPending56.64
IT-1037Catalog item 37, structuralStructuralActive167.40
IT-1038Catalog item 38, mepMEPActive235.86
IT-1039Catalog item 39, siteSiteActive210.50
IT-1040Catalog item 40, generalGeneralPending66.66
IT-1041Catalog item 41, architecturalArchitecturalActive202.10
IT-1042Catalog item 42, structuralStructuralActive269.07
IT-1043Catalog item 43, mepMEPActive166.76
IT-1044Catalog item 44, siteSitePending144.37
IT-1045Catalog item 45, generalGeneralActive246.27
IT-1046Catalog item 46, architecturalArchitecturalActive77.49
IT-1047Catalog item 47, structuralStructuralActive32.33
IT-1048Catalog item 48, mepMEPPending99.71
IT-1049Catalog item 49, siteSiteActive149.99
IT-1050Catalog item 50, generalGeneralActive142.66
IT-1051Catalog item 51, architecturalArchitecturalActive219.98
IT-1052Catalog item 52, structuralStructuralPending146.81
IT-1053Catalog item 53, mepMEPActive167.87
IT-1054Catalog item 54, siteSiteActive193.24
IT-1055Catalog item 55, generalGeneralActive71.89
IT-1056Catalog item 56, architecturalArchitecturalPending49.52
IT-1057Catalog item 57, structuralStructuralActive187.04
IT-1058Catalog item 58, mepMEPActive261.43
IT-1059Catalog item 59, siteSiteActive71.82
IT-1060Catalog item 60, generalGeneralPending54.10
IT-1061Catalog item 61, architecturalArchitecturalActive120.54
IT-1062Catalog item 62, structuralStructuralActive215.77
IT-1063Catalog item 63, mepMEPActive94.07
IT-1064Catalog item 64, siteSitePending121.52
IT-1065Catalog item 65, generalGeneralActive35.78
IT-1066Catalog item 66, architecturalArchitecturalActive237.85
IT-1067Catalog item 67, structuralStructuralActive268.15
IT-1068Catalog item 68, mepMEPPending38.76
IT-1069Catalog item 69, siteSiteActive79.01
IT-1070Catalog item 70, generalGeneralActive103.51
IT-1071Catalog item 71, architecturalArchitecturalActive217.35
IT-1072Catalog item 72, structuralStructuralPending49.67
IT-1073Catalog item 73, mepMEPActive103.33
IT-1074Catalog item 74, siteSiteActive264.86
IT-1075Catalog item 75, generalGeneralActive240.61
IT-1076Catalog item 76, architecturalArchitecturalPending52.13
IT-1077Catalog item 77, structuralStructuralActive208.64
IT-1078Catalog item 78, mepMEPActive217.43
IT-1079Catalog item 79, siteSiteActive105.39
IT-1080Catalog item 80, generalGeneralPending235.07
IT-1081Catalog item 81, architecturalArchitecturalActive233.00
IT-1082Catalog item 82, structuralStructuralActive245.56
IT-1083Catalog item 83, mepMEPActive81.52
IT-1084Catalog item 84, siteSitePending81.98
IT-1085Catalog item 85, generalGeneralActive163.99
IT-1086Catalog item 86, architecturalArchitecturalActive266.16
IT-1087Catalog item 87, structuralStructuralActive107.30
IT-1088Catalog item 88, mepMEPPending200.26
IT-1089Catalog item 89, siteSiteActive59.97
IT-1090Catalog item 90, generalGeneralActive202.36
IT-1091Catalog item 91, architecturalArchitecturalActive139.60
IT-1092Catalog item 92, structuralStructuralPending175.97
IT-1093Catalog item 93, mepMEPActive184.04
IT-1094Catalog item 94, siteSiteActive176.40
IT-1095Catalog item 95, generalGeneralActive216.11
IT-1096Catalog item 96, architecturalArchitecturalPending256.33
IT-1097Catalog item 97, structuralStructuralActive195.00
IT-1098Catalog item 98, mepMEPActive65.24
IT-1099Catalog item 99, siteSiteActive128.59
IT-1100Catalog item 100, generalGeneralPending28.42
IT-1101Catalog item 101, architecturalArchitecturalActive79.34
IT-1102Catalog item 102, structuralStructuralActive263.57
IT-1103Catalog item 103, mepMEPActive40.70
IT-1104Catalog item 104, siteSitePending66.48
IT-1105Catalog item 105, generalGeneralActive195.30
IT-1106Catalog item 106, architecturalArchitecturalActive190.31
IT-1107Catalog item 107, structuralStructuralActive63.48
IT-1108Catalog item 108, mepMEPPending173.02
IT-1109Catalog item 109, siteSiteActive222.62
IT-1110Catalog item 110, generalGeneralActive39.76
IT-1111Catalog item 111, architecturalArchitecturalActive110.88
IT-1112Catalog item 112, structuralStructuralPending239.62
IT-1113Catalog item 113, mepMEPActive176.04
IT-1114Catalog item 114, siteSiteActive106.74
IT-1115Catalog item 115, generalGeneralActive91.10
IT-1116Catalog item 116, architecturalArchitecturalPending144.98
IT-1117Catalog item 117, structuralStructuralActive154.25
IT-1118Catalog item 118, mepMEPActive32.10
IT-1119Catalog item 119, siteSiteActive227.53
IT-1120Catalog item 120, generalGeneralPending39.62
IT-1121Catalog item 121, architecturalArchitecturalActive150.54
IT-1122Catalog item 122, structuralStructuralActive87.89
IT-1123Catalog item 123, mepMEPActive248.79
IT-1124Catalog item 124, siteSitePending146.64
IT-1125Catalog item 125, generalGeneralActive233.92
IT-1126Catalog item 126, architecturalArchitecturalActive61.38
IT-1127Catalog item 127, structuralStructuralActive135.63
IT-1128Catalog item 128, mepMEPPending196.93
IT-1129Catalog item 129, siteSiteActive68.74
IT-1130Catalog item 130, generalGeneralActive254.28
IT-1131Catalog item 131, architecturalArchitecturalActive127.13
IT-1132Catalog item 132, structuralStructuralPending163.40
IT-1133Catalog item 133, mepMEPActive108.84
IT-1134Catalog item 134, siteSiteActive96.97
IT-1135Catalog item 135, generalGeneralActive175.74
IT-1136Catalog item 136, architecturalArchitecturalPending239.43
IT-1137Catalog item 137, structuralStructuralActive224.86
IT-1138Catalog item 138, mepMEPActive35.04
IT-1139Catalog item 139, siteSiteActive156.67
IT-1140Catalog item 140, generalGeneralPending243.67
IT-1141Catalog item 141, architecturalArchitecturalActive222.68
IT-1142Catalog item 142, structuralStructuralActive204.29
IT-1143Catalog item 143, mepMEPActive247.64
IT-1144Catalog item 144, siteSitePending40.21
IT-1145Catalog item 145, generalGeneralActive111.48
IT-1146Catalog item 146, architecturalArchitecturalActive169.98
IT-1147Catalog item 147, structuralStructuralActive269.94
IT-1148Catalog item 148, mepMEPPending97.30
IT-1149Catalog item 149, siteSiteActive105.30
IT-1150Catalog item 150, generalGeneralActive91.13
IT-1151Catalog item 151, architecturalArchitecturalActive122.08
IT-1152Catalog item 152, structuralStructuralPending182.90
IT-1153Catalog item 153, mepMEPActive107.70
IT-1154Catalog item 154, siteSiteActive108.97
IT-1155Catalog item 155, generalGeneralActive147.88
IT-1156Catalog item 156, architecturalArchitecturalPending261.44
IT-1157Catalog item 157, structuralStructuralActive34.78
IT-1158Catalog item 158, mepMEPActive164.06
IT-1159Catalog item 159, siteSiteActive102.57
IT-1160Catalog item 160, generalGeneralPending153.93
IT-1161Catalog item 161, architecturalArchitecturalActive74.69
IT-1162Catalog item 162, structuralStructuralActive136.56
IT-1163Catalog item 163, mepMEPActive124.27
IT-1164Catalog item 164, siteSitePending238.34
IT-1165Catalog item 165, generalGeneralActive182.63
IT-1166Catalog item 166, architecturalArchitecturalActive217.48
IT-1167Catalog item 167, structuralStructuralActive150.78
IT-1168Catalog item 168, mepMEPPending99.07
IT-1169Catalog item 169, siteSiteActive201.01
IT-1170Catalog item 170, generalGeneralActive121.67
IT-1171Catalog item 171, architecturalArchitecturalActive190.11
IT-1172Catalog item 172, structuralStructuralPending139.21
IT-1173Catalog item 173, mepMEPActive145.43
IT-1174Catalog item 174, siteSiteActive253.86
IT-1175Catalog item 175, generalGeneralActive86.94
IT-1176Catalog item 176, architecturalArchitecturalPending216.26
IT-1177Catalog item 177, structuralStructuralActive110.26
IT-1178Catalog item 178, mepMEPActive228.58
IT-1179Catalog item 179, siteSiteActive55.16
IT-1180Catalog item 180, generalGeneralPending83.94
500 rows

500 rows ยท 5 columns: Code · Description · Group · Status · Rate

Documentation

GridColumn (Field, Type, Format), dictionary-backed rows and SuspendRedraw / EndUpdateAsync are still to be written up from Grid/GridColumn.cs, Grid/GridEnums.cs and Grid/GridControl.razor.cs.

An unhandled error has occurred. Reload ๐Ÿ—™

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.