问题标签 [selectonelistbox]

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 投票
1 回答
4519 浏览

jsf - PrimeFaces selectOneListBox

我将 JSF 与 Primefaces 一起使用。当我使用

所有对象都正确列出,但是当我用 p 替换 h 时,

没有任何作用。

错误在哪里?我已经列出了下面的代码。

0 投票
1 回答
338 浏览

jsf - 经过作为论据

我在将对象从actionListenercommandLink 传递给支持 bean 时遇到问题。我拥有的是一个 beanMeasureBean和一个xhtml使用 bean 的文件。

在 xhtml 中我有:

在bean中我有方法:

问题是,无论我是否使用标签<f:ajax>,bean中方法的参数viewCheckpoint始终为null。我需要将该参数传递给bean。它不必是整个对象,只允许传递检查点的 id。我也尝试过的是:

cp而不是ch)。但没有区别。

请帮忙,
马特乌斯

0 投票
1 回答
1344 浏览

ajax - Primefaces ajax SelectOneListBox滚动条在所需位置

我有一个可滚动的 SelectOneListBox,其中包含 >50 个项目。当一个新项目被添加-保存时,它被附加为最后一行,位于当前可视区域之外。我需要列表框自动滚动到新添加的行(已选中)。

添加保存按钮和列表框是ajaxified。我正在使用 Primefaces 5.0。我怎样才能做到这一点?

JSF 页面代码:

0 投票
1 回答
2260 浏览

ajax - p:selectOneListbox ajax 项目选择改变滚动位置

有一个<p:selectOneListbox>大约20个项目。可以在列表中查看前 5 个项目,然后可以滚动选择其余项目。该列表是ajaxified。When the item numbers greater than 5 is selected (after scrolling to it) the scrollbar does not remain at its place; 它移动到顶部位置。这使得所选项目(例如项目 9)不可见。该程序使用 ajax 侦听器。该应用程序使用 PrimeFaces 5.0。

但是,当移除 ajax 侦听器时,选中的(第 9 项)是可见的,并且滚动条不会移动到顶部(在下面的 JSF 页面中移除 p:ajax 标记的侦听器属性)。

我想知道如何在使用 ajax 侦听器时选择任何项目时使滚动条不移动。

JSF 页面:

豆子的代码:

0 投票
1 回答
517 浏览

ajax - p:selectOneListbox ajax 项目删除将滚动位置更改为顶部

有大约 20 个项目的 ap:selectOneListbox。可以在列表中查看前 5 个项目,然后可以滚动选择其余项目。该列表是ajaxified。选择一个列表项,然后单击 ajax 删除按钮,该项目被删除并选择以下项目。这工作正常。但是,列表的滚动条移动到顶部并且新选择的项目不可见 - 当索引大于 5 的项目时。该应用程序使用 PrimeFaces 5.1。

我还尝试使用 Apache MyFaces 2.0 - 使用 f:ajax、h:selectOneListbox 和 h:commandButton 而不是各自的 p: 标签。托管 bean 代码保持不变。在这种情况下,它工作正常 - 滚动条不会移动到顶部(只是根据需要进行调整)。我想要 Primefaces 标签的类似行为。

JSF 页面代码:

豆代码:

0 投票
0 回答
335 浏览

jsf - SelectOneListbox 值集

我正在尝试SelectOneListbox使用 Primefaces 在 JSF 中编写两个代码。问题是第二个 Listbox 没有将值设置为我的支持 bean 变量。不过,第一个 Listbox 工作正常。

xhtml

0 投票
1 回答
251 浏览

jsf - JSF LinkHashMap 从数据库动态填充列表框

我已经使用 LinkHashMap 从数据库中检索数据并将其填充到我在 JSF 中的列表框中。列表框被填充。基本上,如果用户从列表框中选择两个项目并单击计算命令按钮,应用程序应该向他显示总价。基本上在我的表中,我有两列,项目和价格。项目(字符串)显示在列表框中。但我的问题是如何检索作为值的价格(双倍),以便我可以计算用户在 JSF 页面中选择的数量的价格。请帮我解决这个问题。感谢和问候。

请参阅下面的代码:

Java 代码

JSF 页面

0 投票
1 回答
73 浏览

jsf - 设置 SelectOneListbox 默认选择,该选择从哈希图中填充

我有一个 selectOneListBox,其中填充了哈希图的键作为标签,值作为值。

如何将列表中的第一个对象设置为默认选择,使其看起来突出显示

0 投票
1 回答
49 浏览

validation - h:selectOneListBox Validation Error: Value is not Valid

I am getting a Validation Error: Value is not valid error. I have identified the problem to be the equals method. The object selected gets passed correctly as an argument, but for some reason, the entity that is compared with is wrong.

Here is the equals method:

Now for some reason, this.attribute1.getName() is different than other.attribute1.getName(). The object passed into the equals method is the correct one, but the entity itself is a different one than the object passed. How is the value of this.attribute being picked up since this is an entity class where the equals method is at? Am I doing something wrong?

0 投票
1 回答
168 浏览

javascript - how to read text (value) from jsf selectonelistbox itemLabel text?

Below is my JSF

In javascript (In same file)

I want to read the selecteditem's itemLabel's text. (i.e: If I select 01-January, I want the same text into my var x)

x=getElementById('Form:lstmonth').itemLabel // not working x=getElementById('Form:lstmonth').innerText // not working -- returning all months

How to get the itemLabel text? please suggest

Actually I want x=01-January (selected item)