|
1 | 1 |
|
2 | 2 | @{ |
3 | 3 | ViewBag.Title = "TestGrid"; |
| 4 | + |
| 5 | + List<SelectListItem> groupedList = new List<SelectListItem>() |
| 6 | + { |
| 7 | + new SelectListItemGroup() |
| 8 | + { |
| 9 | + Text = "Group1", |
| 10 | + Items = new List<SelectListItem>() |
| 11 | + { |
| 12 | + new SelectListItem() { Text = "Item1", Value = "Item1" }, |
| 13 | + new SelectListItem() { Text = "Item2", Value = "Item2" }, |
| 14 | + new SelectListItem() { Text = "Item3", Value = "Item3" }, |
| 15 | + new SelectListItem() { Text = "Item4", Value = "Item4" }, |
| 16 | + new SelectListItem() { Text = "Item5", Value = "Item5" }, |
| 17 | + } |
| 18 | + }, |
| 19 | + new SelectListItemGroup() |
| 20 | + { |
| 21 | + Text = "Group2", |
| 22 | + Items = new List<SelectListItem>() |
| 23 | + { |
| 24 | + new SelectListItem() { Text = "Item6", Value = "Item6" }, |
| 25 | + new SelectListItem() { Text = "Item7", Value = "Item7" }, |
| 26 | + new SelectListItem() { Text = "Item8", Value = "Item8" }, |
| 27 | + new SelectListItem() { Text = "Item9", Value = "Item9" }, |
| 28 | + new SelectListItem() { Text = "Item10", Value = "Item10" }, |
| 29 | + } |
| 30 | + } |
| 31 | + }; |
4 | 32 | } |
5 | 33 |
|
6 | 34 | @Html.Griddly(new GriddlySettings<TestGridItem>() |
|
16 | 44 | } |
17 | 45 | .Column("test", template: @<a href="http://google.com">google</a>, summaryValue: "Total") |
18 | 46 | .Column(x => x.Test, "Sum", format: "c", summaryFunction: SummaryAggregateFunction.Sum) |
19 | | - .Column(x => x.Test, "Min", format: "c", summaryFunction: SummaryAggregateFunction.Min) |
20 | | - .Column(x => x.Test, "Max", format: "c", summaryFunction: SummaryAggregateFunction.Max) |
21 | | - .Column(x => x.Test, "Avg", format: "c", summaryFunction: SummaryAggregateFunction.Average) |
22 | | - .Column(x => x.FirstName, "First Name") |
| 47 | + .Column(x => x.Test, "Min", format: "c", summaryFunction: SummaryAggregateFunction.Min) |
| 48 | + .Column(x => x.Test, "Max", format: "c", summaryFunction: SummaryAggregateFunction.Max) |
| 49 | + .Column(x => x.Test, "Avg", format: "c", summaryFunction: SummaryAggregateFunction.Average, filter: x => x.FilterList(groupedList)) |
| 50 | + .Column(x => x.FirstName, "First Name", filter: x => |
| 51 | + { |
| 52 | + GriddlyFilterList filter = x.FilterList(TestGridItem.UsStates); |
| 53 | + |
| 54 | + filter.CaptionPlural = "State"; |
| 55 | + filter.DisplayItemCount = 2; |
| 56 | + |
| 57 | + return filter; |
| 58 | + }) |
23 | 59 | .Column(x => x.LastName, "Last Name", defaultSort: SortDirection.Ascending, filter: x => x.FilterBox(FilterDataType.String)) |
24 | 60 | .Column(x => x.Company, "Company", filter: x => x.FilterBox(FilterDataType.Decimal)) |
25 | 61 | .Column(x => x.Address, "Address", filter: x => x.FilterBox(FilterDataType.Currency)) |
|
0 commit comments