6.1 Creating the Filter List

The Method tp_GetOptionFamilies determines the set of Filters (Options) by returning a JSON-formatted string containing a name/value list where the name specifies the Name of the Filter/Option, and the value specifies the list of valid values. The default implementation for this Method is as follows:

/*

var optionFamilies = {

       "Region": [ "Africa", "Asia", "Central America", "Eastern Europe", "European Union", "Middle East", "North America", "Oceana", "South America", "The Caribbean"],

       "Zone": ["A", "B", "C"],

       "Model": ["X", "Y", "C"]

   };

*/

Dictionary<string, List<string>> optionFamilies = new Dictionary<string, List<string>> ();
optionFamilies.Add(“Region”, new List<String>() { “Africa”, “Asia”, “Central America”, “Eastern Europe”, “European Union”, “Middle East”, “North America”, “Oceana”, “South America”, “The Caribbean” } );
optionFamilies.Add(“Zone”, new List<String>() { “A”, “B”, “C” } );
optionFamilies.Add(“Model”, new List<String>() { “X”, “Y”, “Z” } );
String json = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(optionFamilies);
return this.getInnovator().newResult(json);

The Method uses a Dictionary class to construct the data for the returned JSON data structure. It is possible to return a JSON-formatted string as well using the example pattern described by the comment at the top of the method code. Implementations can use this example Method as a guide for constructing static Filters, stored the list data in custom Items and retrieve the values in this Method, and/or apply whatever custom logic is necessary to construct a dynamic set of data.