9ed545ac282ed5f76e09cefa715506b3cb6221d9
FAQ/PostProcessEqualsSelectList.md
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +#PostProcessEqualsSelectList() |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +This method runs immediately after the ProcessEqualsSelectList method that is responsible for loading a list of all possible values for data-driven filters. This override can be used to edit the list of values after the data has been retrieved and to have control over the labels and values of each item. Normally, the labels and values of the filter options are synonymous, using the same value for both the label and value. For instance, one could have a data-driven filter that returns the value "USA" and then in PostProcessEqualsSelect, the label corresponding to that value can be changed to read "United States of America". The filter would still pass the value USA logically, but the full name would be displayed as opposed to the abbreviation. |
|
| 8 | + |
|
| 9 | +The list of filter types that load data are as follows: |
|
| 10 | + |
|
| 11 | +* Equals(List) |
|
| 12 | +* Equals(Autocomplete) |
|
| 13 | +* Equals(Select) |
|
| 14 | +* Equals(Multiple) |
|
| 15 | +* Equals(Popup) |
|
| 16 | +* Equals(Checkboxes) |
|
| 17 | +* Doesn't Equal(Select) |
|
| 18 | +* Doesn't Equal Multiple |
|
| 19 | +* Doesn't Equal(Popup) |
|
| 20 | + |
|
| 21 | +##Sample C♯ Method |
|
| 22 | + |
|
| 23 | +```csharp |
|
| 24 | +public override void PostProcessEqualsSelectList(Column column, List<string> labels, List<string> values) |
|
| 25 | +{ |
|
| 26 | + for(int i = 0; i < values.Count; i++) |
|
| 27 | + { |
|
| 28 | + string myValue = values[i]; |
|
| 29 | + if (myValue == "USA") |
|
| 30 | + labels[i] = "United States of America"; |
|
| 31 | + else |
|
| 32 | + labels[i] = values[i]; |
|
| 33 | + } |
|
| 34 | +} |
|
| 35 | +``` |
|
| 36 | + |
|
| 37 | +##Sample VB.NET Method |
|
| 38 | + |
|
| 39 | +```visualbasic |
|
| 40 | +Public Overrides Sub PostProcessEqualsSelectList(column As Column, labels As List(Of String), values As List(Of String)) |
|
| 41 | + For i As Integer = 0 To values.Count - 1 |
|
| 42 | + Dim myValue As String = values(i) |
|
| 43 | + If myValue.Equals("USA") Then |
|
| 44 | + labels(i) = "United States of America" |
|
| 45 | + Else |
|
| 46 | + labels(i) = values(i) |
|
| 47 | + End If |
|
| 48 | + Next |
|
| 49 | +End Sub |
|
| 50 | +``` |