All the samples of the Dependent Selects have just a display value. For Example they show
final Map<String, String[]> departments = new HashMap<String, String[]>();
departments.put("Marketing", new String[] { "Advertising", "Community Relations" });
departments.put("Sales", new String[] { "Channed Sales", "Direct Sales" });
departments.put("Manufacturing", new String[] { "Design", "Development", "QA" });
departments.put("Services", new String[] { "Support", "Consulting" });
I am looking for a solution where I can do something like
departments.put("Marketing", marketingHashMap);
departments.put("Sales", salesHashMap); etc..
where the marketing Hashmap for example looks like
final Map<String, String[]> marketingHashMap = new HashMap<String, String[]>();
departments.put("A", "Advertising");
departments.put("C", "Community Relations");
This way when you choose the Marketing it populates another field that has a valueMap of key value pairs. So it displays the value but saves the key as that actual value of the data. This mostly works in that the display is correct put once i choose it, the grid shows the key instead of the value.
Anyone know a way to deal with this??
SelectItem selectItem = new SelectItem();
selectItem.setAddUnknownValues(false);
MXListGridField benchmark = new MXListGridField("benchmark", "Benchmark");
benchmark.setType(ListGridFieldType.TEXT);
benchmark.setCanEdit(true);
benchmark.setRequired(true);
benchmark.setEditorValueMapFunction(valueMap);
benchmark.setEditorProperties(selectItem);
protected EditorValueMapFunction valueMap = new EditorValueMapFunction()
{
public Map getEditorValueMap(Map values, ListGridField field, ListGrid grid)
{
... String division = (String) values.get("division");
Map<String, String> divisions = departments.get(division);
return divisions ;
}
};
but here the divisions has different values of key vs value
final Map<String, String[]> departments = new HashMap<String, String[]>();
departments.put("Marketing", new String[] { "Advertising", "Community Relations" });
departments.put("Sales", new String[] { "Channed Sales", "Direct Sales" });
departments.put("Manufacturing", new String[] { "Design", "Development", "QA" });
departments.put("Services", new String[] { "Support", "Consulting" });
I am looking for a solution where I can do something like
departments.put("Marketing", marketingHashMap);
departments.put("Sales", salesHashMap); etc..
where the marketing Hashmap for example looks like
final Map<String, String[]> marketingHashMap = new HashMap<String, String[]>();
departments.put("A", "Advertising");
departments.put("C", "Community Relations");
This way when you choose the Marketing it populates another field that has a valueMap of key value pairs. So it displays the value but saves the key as that actual value of the data. This mostly works in that the display is correct put once i choose it, the grid shows the key instead of the value.
Anyone know a way to deal with this??
SelectItem selectItem = new SelectItem();
selectItem.setAddUnknownValues(false);
MXListGridField benchmark = new MXListGridField("benchmark", "Benchmark");
benchmark.setType(ListGridFieldType.TEXT);
benchmark.setCanEdit(true);
benchmark.setRequired(true);
benchmark.setEditorValueMapFunction(valueMap);
benchmark.setEditorProperties(selectItem);
protected EditorValueMapFunction valueMap = new EditorValueMapFunction()
{
public Map getEditorValueMap(Map values, ListGridField field, ListGrid grid)
{
... String division = (String) values.get("division");
Map<String, String> divisions = departments.get(division);
return divisions ;
}
};
but here the divisions has different values of key vs value
Comment