-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
b:selectOneMenu doesn't recognize value from SelectItems collection with disabled attribute set to true. #907
Comments
Thanks for your detailed bug description! That should help us to find and solve the bug quickly. |
Did I simplify your example too much? My version works like charm. Can you have a look at it, please? Maybe it helps to track down the bug. BTW, you can also inspect the result of the AJAX response after clicking the button. Maybe there's a difference between the disabled and the regular case? Here`s my bean: import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;
@ManagedBean
@ViewScoped
public class FletesController implements Serializable {
private static final long serialVersionUID = 1L;
private List<SelectItem> tipos;
private SelectItem selectedFlete = new SelectItem("02", "Steel");
public FletesController() {
tipos = new ArrayList<>();
getTipos().add(new SelectItem("01", "Wood"));
getTipos().add(new SelectItem("02", "Steel"));
getTipos().add(new SelectItem("03", "Plastic"));
}
// Listener in b:dataTable commandButton
public void onEdit(SelectItem flete) {
setSelectedFlete(new SelectItem("03", "Plastic"));
}
public SelectItem getSelectedFlete() {
return selectedFlete;
}
public void setSelectedFlete(SelectItem selectedFlete) {
this.selectedFlete = selectedFlete;
}
public List<SelectItem> getTipos() {
return tipos;
}
public void setTipos(List<SelectItem> tipos) {
this.tipos = tipos;
}
} And the JSF file: <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>
<h:body style="padding-top: 60px">
<h:form>
<b:panelGrid id="panelFleEdit" columns="2">
<b:commandButton look="info" icon="eye-open" ajax="true" process="@this" actionListener="#{fletesController.onEdit(flete)}" update="@next">
<f:param name="disabledToggle" value="true" transient="true"/>
</b:commandButton>
<b:selectOneMenu class="modalFleteEdit" value="#{fletesController.selectedFlete.value}" label-col-md="8" label="Tipo:" disabled="true">
<f:selectItems value="#{fletesController.tipos}"/>
</b:selectOneMenu>
</b:panelGrid>
</h:form>
</h:body>
</html>l |
Hi, yes it's a little simplified, but let me take a look again, the least I want is make you lose time, though I spent a day trying to make it work without success. May it be a mix of object identity, the param I'm setting inside command button, and the render phase? I'll keep you informed. Thanks. |
¡Muchisimas gracias! BTW, if you want to tackle the problem from the other (my) side: I've uploaded my attempt to reproduce your bug in our showcase. The showcase is a simple Maven application running in a Tomcat. The only thing you might want to change is the dependency to BootsFaces (currently 1.2.1-SNAPSHOT in the pom.xml). |
Hi, again. The problem is with the From your showcase:
Thank you. |
related to #797 ? |
@modima65 Maybe it's a good idea to send us a reproducer - i.e. a minimal but complete project showing the bug. Among other things, "minimal" means there's no database, so all we need to do is to take your Maven project and deploy it in Tomcat or (say) Wildfly. Alternatively, you can also debug BootsFaces yourself. More likely than not, the bug (if there's one) is in the class |
No error, silent.
b:selectOneMenu
value andSelectItems
collection are prepared and set in the same bean prior to render page. One of the values in the collection matches exactly the value inb:selectOneMenu
. Whenb:selectOneMenu
disabled
attribute is false or not specified (default), the value in such component matches correctly the one in thef:selectItems
collection. Whenb:selectOneMenu
disabled
attribute is true, the value in such component does not match the value in thef:selectItems
collection and the component shows empty value.When BootsFaces
b:selectOneMenu
is replaced by JSFh:selectOneMenu
the value matches the one in thef:selectItems
collection whetherdisabled
attribute be set to true or false.1.2
Safari 11.0.2
macOS 10.13.2
The Bean:
The XHTML:
I have to use two components: one
h:outputText
for disabled situation and oneb:selectOneMenu
when enabled, but togglingrendered
.The text was updated successfully, but these errors were encountered: