smartgwt remove duplicate values from selectitem
Does anybody know how to hide duplicate values (course names) from SelectItem
?
My code:
SelectItem courseOfferingItem = new SelectItem ("courseOffering.id", "Course Offering");
courseOfferingItem.setOptionDataSource(CoursesOfferingDS.getInstance());
courseOfferingItem.setDisplayField("courseOffering.courseName");
c开发者_StackOverflowourseOfferingItem.setShowDisabled(false);
SelectItem
is showing courses CBNST, FIT, FIT, DS but I don't want to show FIT two times.
you must use LinkedHashMap to populate your ComboBox items. it will be easy to set and manage and duplicate values will be removed. it can be done by.... SelectItem courseOfferingItem = new SelectItem(); courseOfferingItem.setValueMap(linedHashMap);
and linkedHashMap will contain your item id and item value...hope it will be useful to you...
精彩评论