我想设计一个只显示所选客户和服务项目的视图,因此我创建了一个视图,其中对客户和服务列进行了分类,并创建了该视图的视图面板。如果我放 document1.getDocument()。getItemValueString(“Customer”)
它适用于限制单一类别。我如何通过拖曳分类列来做到这一点。
提前致谢
答案 0 :(得分:0)
你可以在重复中实现重复吗?
第一次重复将捕获您的第一个类别。然后在里面你有一个面板和一个重复,第二个重复将进一步过滤第二类
的数据源答案 1 :(得分:0)
然后使用所选值作为一列。让我们假设您的原始列是客户和项目。因此,您的新列将具有公式customer+"~"+project
。然后,您可以读取此值以填充SSJS对象或变量,以便您可以检索客户(第一个下拉列表)和项目(第二个下拉列表)。在下拉列表中,您可以使用格式Display|Value
,因此一个好方法是使用customer~project格式的值。
如上所述,你可以用Java或JavaScript做到这一点。由于我非常喜欢Java的集合框架,所以这里是Java版本:
import java.util.Set;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;
import lotus.domino.Database;
import lotus.domino.NotesException;
import lotus.domino.View;
import lotus.domino.ViewEntry;
import lotus.domino.ViewEntryCollection;
public class SplitCategoryBean {
private static final String SEPARATOR = "~";
private final Map<String,Set<String>> allCategories = new TreeMap<String, Set<String>>();
public void populate(Database db, String viewName) throws NotesException {
View v = db.getView(viewName);
ViewEntryCollection vec = v.getAllEntries();
ViewEntry ve = vec.getFirstEntry();
while (ve != null) {
ViewEntry nextVE = vec.getNextEntry(ve);
this.addEntry(ve.getColumnValues().get(0).toString());
ve.recycle();
ve = nextVE;
}
vec.recycle();
v.recycle();
}
private void addEntry(String combinedCategory) {
String[] splitCategory = combinedCategory.split(SEPARATOR);
String key = splitCategory[0];
String value = splitCategory[1];
Set<String> thisCategory = (this.allCategories.containsKey(key)) ? this.allCategories.get(key): new TreeSet<String>();
thisCategory.add(value+"|"+combinedCategory);
this.allCategories.put(key, thisCategory);
}
public Set<String> getFirstCategory() {
return this.allCategories.keySet();
}
public Set<String> getSecondCategoryReadyForDropDown(String key) {
return this.allCategories.get(key);
}
}
您可以将其配置为托管bean(viewScope),并在queryOpen中调用populate方法。然后,您可以轻松地将您的第一个选择绑定到#{beanName.firstCategory}
以进行选择,例如值#{viewScope.curCustomer}
。第二个下拉列表使用rendered="#{viewScope.curCustomer}"
,因此它仅显示选择客户的时间。然后将选择绑定到#{javascript:beanName.getSecondCategoryReadyForDropDown(viewScope.curCustomer);
对更改事件进行刷新,并仅在选择了项目时呈现视图。
这对你有用吗?
答案 2 :(得分:0)
谢谢你们
我创建了一个视图,第一列已分类,其值为Customer + Service,然后放入
document1.getDocument()。getItemValueString(“Customer”)+ document1.getDocument()。getItemValueString(“Service”)
在视图面板的“按类别名称过滤”中,它现在可以使用。