问题标签 [selectmanymenu]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
207 浏览

jsf - Primefaces SelectManyMenu 的对象列表,从另一个列表中设置预选值

我有ArrayList一个自定义对象 ( ArrayList<Cell> allCells) 和一个sublistallList( ArrayList<Cell> checkedCells)。我想做的是在 a中显示allCells 数组列表,并在菜单中p:selectManyMenu显示我的子列表checkedCells的对象。checked

我知道上面的问题应该已经在这里得到了回答,但我认为对于这样一个基本问题,答案质量低下且不清楚,而且 OP 没有使用converter我需要使用的。

细胞类

细胞转换器类

selectManyMenu 代码

不幸的是,即使列表在 selectmanymenu 中正确显示,属于checkedCells列表的元素也不会被检查

假设checkedCells列表包含具有值的单元格cell2 and cell4

我希望列表像这样显示

在此处输入图像描述

但是列表是这样显示的(即使我调试了`checkedCells 变量并且实际上包含了这个值)

在此处输入图像描述

Primefaces 版本:7.0

提前致谢。