Dynamic columns
GridControlRows 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.
| Code | Description | Group | Status | Rate |
|---|---|---|---|---|
| IT-1001 | Catalog item 1, architectural | Architectural | Active | 134.91 |
| IT-1002 | Catalog item 2, structural | Structural | Active | 258.84 |
| IT-1003 | Catalog item 3, mep | MEP | Active | 73.09 |
| IT-1004 | Catalog item 4, site | Site | Pending | 94.38 |
| IT-1005 | Catalog item 5, general | General | Active | 29.44 |
| IT-1006 | Catalog item 6, architectural | Architectural | Active | 175.82 |
| IT-1007 | Catalog item 7, structural | Structural | Active | 157.29 |
| IT-1008 | Catalog item 8, mep | MEP | Pending | 28.71 |
| IT-1009 | Catalog item 9, site | Site | Active | 215.49 |
| IT-1010 | Catalog item 10, general | General | Active | 158.75 |
| IT-1011 | Catalog item 11, architectural | Architectural | Active | 223.02 |
| IT-1012 | Catalog item 12, structural | Structural | Pending | 121.65 |
| IT-1013 | Catalog item 13, mep | MEP | Active | 130.62 |
| IT-1014 | Catalog item 14, site | Site | Active | 40.89 |
| IT-1015 | Catalog item 15, general | General | Active | 140.15 |
| IT-1016 | Catalog item 16, architectural | Architectural | Pending | 114.75 |
| IT-1017 | Catalog item 17, structural | Structural | Active | 265.53 |
| IT-1018 | Catalog item 18, mep | MEP | Active | 43.83 |
| IT-1019 | Catalog item 19, site | Site | Active | 61.51 |
| IT-1020 | Catalog item 20, general | General | Pending | 172.72 |
| IT-1021 | Catalog item 21, architectural | Architectural | Active | 51.20 |
| IT-1022 | Catalog item 22, structural | Structural | Active | 105.39 |
| IT-1023 | Catalog item 23, mep | MEP | Active | 91.79 |
| IT-1024 | Catalog item 24, site | Site | Pending | 81.66 |
| IT-1025 | Catalog item 25, general | General | Active | 42.56 |
| IT-1026 | Catalog item 26, architectural | Architectural | Active | 245.34 |
| IT-1027 | Catalog item 27, structural | Structural | Active | 75.27 |
| IT-1028 | Catalog item 28, mep | MEP | Pending | 211.51 |
| IT-1029 | Catalog item 29, site | Site | Active | 204.63 |
| IT-1030 | Catalog item 30, general | General | Active | 113.97 |
| IT-1031 | Catalog item 31, architectural | Architectural | Active | 142.98 |
| IT-1032 | Catalog item 32, structural | Structural | Pending | 255.18 |
| IT-1033 | Catalog item 33, mep | MEP | Active | 123.50 |
| IT-1034 | Catalog item 34, site | Site | Active | 111.86 |
| IT-1035 | Catalog item 35, general | General | Active | 231.88 |
| IT-1036 | Catalog item 36, architectural | Architectural | Pending | 56.64 |
| IT-1037 | Catalog item 37, structural | Structural | Active | 167.40 |
| IT-1038 | Catalog item 38, mep | MEP | Active | 235.86 |
| IT-1039 | Catalog item 39, site | Site | Active | 210.50 |
| IT-1040 | Catalog item 40, general | General | Pending | 66.66 |
| IT-1041 | Catalog item 41, architectural | Architectural | Active | 202.10 |
| IT-1042 | Catalog item 42, structural | Structural | Active | 269.07 |
| IT-1043 | Catalog item 43, mep | MEP | Active | 166.76 |
| IT-1044 | Catalog item 44, site | Site | Pending | 144.37 |
| IT-1045 | Catalog item 45, general | General | Active | 246.27 |
| IT-1046 | Catalog item 46, architectural | Architectural | Active | 77.49 |
| IT-1047 | Catalog item 47, structural | Structural | Active | 32.33 |
| IT-1048 | Catalog item 48, mep | MEP | Pending | 99.71 |
| IT-1049 | Catalog item 49, site | Site | Active | 149.99 |
| IT-1050 | Catalog item 50, general | General | Active | 142.66 |
| IT-1051 | Catalog item 51, architectural | Architectural | Active | 219.98 |
| IT-1052 | Catalog item 52, structural | Structural | Pending | 146.81 |
| IT-1053 | Catalog item 53, mep | MEP | Active | 167.87 |
| IT-1054 | Catalog item 54, site | Site | Active | 193.24 |
| IT-1055 | Catalog item 55, general | General | Active | 71.89 |
| IT-1056 | Catalog item 56, architectural | Architectural | Pending | 49.52 |
| IT-1057 | Catalog item 57, structural | Structural | Active | 187.04 |
| IT-1058 | Catalog item 58, mep | MEP | Active | 261.43 |
| IT-1059 | Catalog item 59, site | Site | Active | 71.82 |
| IT-1060 | Catalog item 60, general | General | Pending | 54.10 |
| IT-1061 | Catalog item 61, architectural | Architectural | Active | 120.54 |
| IT-1062 | Catalog item 62, structural | Structural | Active | 215.77 |
| IT-1063 | Catalog item 63, mep | MEP | Active | 94.07 |
| IT-1064 | Catalog item 64, site | Site | Pending | 121.52 |
| IT-1065 | Catalog item 65, general | General | Active | 35.78 |
| IT-1066 | Catalog item 66, architectural | Architectural | Active | 237.85 |
| IT-1067 | Catalog item 67, structural | Structural | Active | 268.15 |
| IT-1068 | Catalog item 68, mep | MEP | Pending | 38.76 |
| IT-1069 | Catalog item 69, site | Site | Active | 79.01 |
| IT-1070 | Catalog item 70, general | General | Active | 103.51 |
| IT-1071 | Catalog item 71, architectural | Architectural | Active | 217.35 |
| IT-1072 | Catalog item 72, structural | Structural | Pending | 49.67 |
| IT-1073 | Catalog item 73, mep | MEP | Active | 103.33 |
| IT-1074 | Catalog item 74, site | Site | Active | 264.86 |
| IT-1075 | Catalog item 75, general | General | Active | 240.61 |
| IT-1076 | Catalog item 76, architectural | Architectural | Pending | 52.13 |
| IT-1077 | Catalog item 77, structural | Structural | Active | 208.64 |
| IT-1078 | Catalog item 78, mep | MEP | Active | 217.43 |
| IT-1079 | Catalog item 79, site | Site | Active | 105.39 |
| IT-1080 | Catalog item 80, general | General | Pending | 235.07 |
| IT-1081 | Catalog item 81, architectural | Architectural | Active | 233.00 |
| IT-1082 | Catalog item 82, structural | Structural | Active | 245.56 |
| IT-1083 | Catalog item 83, mep | MEP | Active | 81.52 |
| IT-1084 | Catalog item 84, site | Site | Pending | 81.98 |
| IT-1085 | Catalog item 85, general | General | Active | 163.99 |
| IT-1086 | Catalog item 86, architectural | Architectural | Active | 266.16 |
| IT-1087 | Catalog item 87, structural | Structural | Active | 107.30 |
| IT-1088 | Catalog item 88, mep | MEP | Pending | 200.26 |
| IT-1089 | Catalog item 89, site | Site | Active | 59.97 |
| IT-1090 | Catalog item 90, general | General | Active | 202.36 |
| IT-1091 | Catalog item 91, architectural | Architectural | Active | 139.60 |
| IT-1092 | Catalog item 92, structural | Structural | Pending | 175.97 |
| IT-1093 | Catalog item 93, mep | MEP | Active | 184.04 |
| IT-1094 | Catalog item 94, site | Site | Active | 176.40 |
| IT-1095 | Catalog item 95, general | General | Active | 216.11 |
| IT-1096 | Catalog item 96, architectural | Architectural | Pending | 256.33 |
| IT-1097 | Catalog item 97, structural | Structural | Active | 195.00 |
| IT-1098 | Catalog item 98, mep | MEP | Active | 65.24 |
| IT-1099 | Catalog item 99, site | Site | Active | 128.59 |
| IT-1100 | Catalog item 100, general | General | Pending | 28.42 |
| IT-1101 | Catalog item 101, architectural | Architectural | Active | 79.34 |
| IT-1102 | Catalog item 102, structural | Structural | Active | 263.57 |
| IT-1103 | Catalog item 103, mep | MEP | Active | 40.70 |
| IT-1104 | Catalog item 104, site | Site | Pending | 66.48 |
| IT-1105 | Catalog item 105, general | General | Active | 195.30 |
| IT-1106 | Catalog item 106, architectural | Architectural | Active | 190.31 |
| IT-1107 | Catalog item 107, structural | Structural | Active | 63.48 |
| IT-1108 | Catalog item 108, mep | MEP | Pending | 173.02 |
| IT-1109 | Catalog item 109, site | Site | Active | 222.62 |
| IT-1110 | Catalog item 110, general | General | Active | 39.76 |
| IT-1111 | Catalog item 111, architectural | Architectural | Active | 110.88 |
| IT-1112 | Catalog item 112, structural | Structural | Pending | 239.62 |
| IT-1113 | Catalog item 113, mep | MEP | Active | 176.04 |
| IT-1114 | Catalog item 114, site | Site | Active | 106.74 |
| IT-1115 | Catalog item 115, general | General | Active | 91.10 |
| IT-1116 | Catalog item 116, architectural | Architectural | Pending | 144.98 |
| IT-1117 | Catalog item 117, structural | Structural | Active | 154.25 |
| IT-1118 | Catalog item 118, mep | MEP | Active | 32.10 |
| IT-1119 | Catalog item 119, site | Site | Active | 227.53 |
| IT-1120 | Catalog item 120, general | General | Pending | 39.62 |
| IT-1121 | Catalog item 121, architectural | Architectural | Active | 150.54 |
| IT-1122 | Catalog item 122, structural | Structural | Active | 87.89 |
| IT-1123 | Catalog item 123, mep | MEP | Active | 248.79 |
| IT-1124 | Catalog item 124, site | Site | Pending | 146.64 |
| IT-1125 | Catalog item 125, general | General | Active | 233.92 |
| IT-1126 | Catalog item 126, architectural | Architectural | Active | 61.38 |
| IT-1127 | Catalog item 127, structural | Structural | Active | 135.63 |
| IT-1128 | Catalog item 128, mep | MEP | Pending | 196.93 |
| IT-1129 | Catalog item 129, site | Site | Active | 68.74 |
| IT-1130 | Catalog item 130, general | General | Active | 254.28 |
| IT-1131 | Catalog item 131, architectural | Architectural | Active | 127.13 |
| IT-1132 | Catalog item 132, structural | Structural | Pending | 163.40 |
| IT-1133 | Catalog item 133, mep | MEP | Active | 108.84 |
| IT-1134 | Catalog item 134, site | Site | Active | 96.97 |
| IT-1135 | Catalog item 135, general | General | Active | 175.74 |
| IT-1136 | Catalog item 136, architectural | Architectural | Pending | 239.43 |
| IT-1137 | Catalog item 137, structural | Structural | Active | 224.86 |
| IT-1138 | Catalog item 138, mep | MEP | Active | 35.04 |
| IT-1139 | Catalog item 139, site | Site | Active | 156.67 |
| IT-1140 | Catalog item 140, general | General | Pending | 243.67 |
| IT-1141 | Catalog item 141, architectural | Architectural | Active | 222.68 |
| IT-1142 | Catalog item 142, structural | Structural | Active | 204.29 |
| IT-1143 | Catalog item 143, mep | MEP | Active | 247.64 |
| IT-1144 | Catalog item 144, site | Site | Pending | 40.21 |
| IT-1145 | Catalog item 145, general | General | Active | 111.48 |
| IT-1146 | Catalog item 146, architectural | Architectural | Active | 169.98 |
| IT-1147 | Catalog item 147, structural | Structural | Active | 269.94 |
| IT-1148 | Catalog item 148, mep | MEP | Pending | 97.30 |
| IT-1149 | Catalog item 149, site | Site | Active | 105.30 |
| IT-1150 | Catalog item 150, general | General | Active | 91.13 |
| IT-1151 | Catalog item 151, architectural | Architectural | Active | 122.08 |
| IT-1152 | Catalog item 152, structural | Structural | Pending | 182.90 |
| IT-1153 | Catalog item 153, mep | MEP | Active | 107.70 |
| IT-1154 | Catalog item 154, site | Site | Active | 108.97 |
| IT-1155 | Catalog item 155, general | General | Active | 147.88 |
| IT-1156 | Catalog item 156, architectural | Architectural | Pending | 261.44 |
| IT-1157 | Catalog item 157, structural | Structural | Active | 34.78 |
| IT-1158 | Catalog item 158, mep | MEP | Active | 164.06 |
| IT-1159 | Catalog item 159, site | Site | Active | 102.57 |
| IT-1160 | Catalog item 160, general | General | Pending | 153.93 |
| IT-1161 | Catalog item 161, architectural | Architectural | Active | 74.69 |
| IT-1162 | Catalog item 162, structural | Structural | Active | 136.56 |
| IT-1163 | Catalog item 163, mep | MEP | Active | 124.27 |
| IT-1164 | Catalog item 164, site | Site | Pending | 238.34 |
| IT-1165 | Catalog item 165, general | General | Active | 182.63 |
| IT-1166 | Catalog item 166, architectural | Architectural | Active | 217.48 |
| IT-1167 | Catalog item 167, structural | Structural | Active | 150.78 |
| IT-1168 | Catalog item 168, mep | MEP | Pending | 99.07 |
| IT-1169 | Catalog item 169, site | Site | Active | 201.01 |
| IT-1170 | Catalog item 170, general | General | Active | 121.67 |
| IT-1171 | Catalog item 171, architectural | Architectural | Active | 190.11 |
| IT-1172 | Catalog item 172, structural | Structural | Pending | 139.21 |
| IT-1173 | Catalog item 173, mep | MEP | Active | 145.43 |
| IT-1174 | Catalog item 174, site | Site | Active | 253.86 |
| IT-1175 | Catalog item 175, general | General | Active | 86.94 |
| IT-1176 | Catalog item 176, architectural | Architectural | Pending | 216.26 |
| IT-1177 | Catalog item 177, structural | Structural | Active | 110.26 |
| IT-1178 | Catalog item 178, mep | MEP | Active | 228.58 |
| IT-1179 | Catalog item 179, site | Site | Active | 55.16 |
| IT-1180 | Catalog item 180, general | General | Pending | 83.94 |
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.