Is there any way to set selectManyCheckbox title dynamically ? In title I want to show Item name .
<h:selectManyCheckbox id="sType" value="#{studentBean.optionalsubjects}" converter="subjectConverter" required="true">
<f:selectItems value="#{subjectBean.oplist}" var="sType" itemLabel="#{sType.detail}" itemDescription="#{sType.detail}" />
</h:selectManyCheckbox>
I think this won't work with h:selectManyCheckbox since the title attribute is the same for all select items.
You could try javascript like the jquery tooltip plugin in order to attach tooltips on client side.
Related
I am working on a customer profile page that has various elements viz. h:selectOneMenu, h:selectOneRadio, h:selectBooleanCheckbox, h:selectManyCheckbox which are populated using master values from the database using List<MasterDTO>. The elements display perfectly when the page is in edit mode. However when the page is changed to view mode, instead of the selected item label being displayed, the selected item value is displayed. E.g. Need to display Single as Marital Status in view mode, instead it displays 001.
Please refer sample code below. I do not want to change the List object to something like a Map<K,V> across all the code. I am using JSF 2.0 and Primefaces 3.4.2. Is there a solution for this?
Select One Menu
<h:selectOneMenu id="marital_status" style="width:178px;"
rendered="#{customerProfileBean.editMode}"
value="#{customerProfileBean.marital_status}">
<f:selectItem itemValue="-1" itemLabel="--- Select ---" />
<f:selectItems value="#{customerProfileBean.maritalStatusList}"
var="mst" itemLabel="#{mst.valueName}" itemValue="#{mst.valueCode}" />
</h:selectOneMenu>
<h:outputText rendered="#{not customerProfileBean.editMode}"
value="#{customerProfileBean.marital_status}" />
Select Many Check Box
<h:selectManyCheckbox id="loanTypes" styleClass="selectOptionSpace"
rendered="#{customerProfileBean.editMode}"
value="#{customerProfileBean.loanTypes}">
<f:selectItems value="#{customerProfileBean.creditFacList}"
var="mst" itemLabel="#{mst.valueName}" itemValue="#{mst.valueCode}" />
</h:selectManyCheckbox>
<h:outputText rendered="#{not customerProfileBean.editMode}"
value="#{customerProfileBean.custLoanType}" />
Replaced the jsf controls with the primefaces controls viz. p:selectOneMenu and p:selectManyCheckbox which fixed the problem of displaying value instead of code.
I have a dropdown and checkbox in my page and if we select a dropdown then the checkbox has to be disabled. We should not use JavaScript for this. I am new to JSF. Is there a way by using JSF. Any ideas.
Just add a <f:ajax> which executes on change of the dropdown and updates the checkbox whereby its disabled attribute checks if the dropdown's value is not empty.
E.g.:
<h:selectOneMenu value="#{bean.selectedItem}">
<f:selectItems value="#{bean.availableItems}" />
<f:ajax render="checkbox" />
</h:selectOneMenu>
<h:selectBooleanCheckbox id="checkbox" disabled="#{not empty bean.selectedItem}" />
That's basically all.
Please note that this uses under the covers still JavaScript for the job! The only difference is that you don't need to manually write any line of JavaScript code, instead JSF autogenerates the necessary JS code for you.
I am using struts.ui.theme = simple and it appears to disable the label attribute of s:select tag.
Is there any way to use the struts theme without disabling the label attribute?
For perticular page try this
<s:set name="theme" value="'simple'" scope="page" />
You can use theme for that particular element.
<s:select theme="xhtml" .../>
I'm using Primefaces and MyFaces. I would like to use the selectBooleanButton component, to control visibility of other components within a long and rather complex form.
simplified sample code:
<p:selectBooleanButton
onLabel="Comment" offLabel="Comment"
onIcon="ui-icon-check" offIcon="ui-icon-close"
value="#{not empty myBean.comment}"
onchange="toggleDisplay(this.checked,'myForm:commentPanel');" />
<h:panelGroup id="commentPanel"
style="display:#{empty myBean.comment ? 'none' : 'block'}">
<p:inputTextarea value="{myBean.comment}"/>
</h:panelGroup>
The javascript in the onchange attribute simply toggles the display style from none to block and vice-versa to hide or unhide the panel group. I want/need the components to remain in the view, I do not want to use rendered attributes to remove them completely.
Where I get into trouble is because of the EL construct used in the value attribute of the setBooleanButton component. I do realize that this EL statement is not compatible with the set operation, and this results in an exception.
What I want to be able to do is when the form is loaded, have the initial status of the selectBooleanButton components set to 'on' when the comment property has some existing text it, and 'off' when it is empty. I am looking for a way to work around this that would not require me to create a property in the model for each and every instance where I want to hide the panel, as that would result in dozens and dozens of properties because my real world form is very large with many of these comment sections.
I also posted this question on Primefaces forum, and did not receive any answers there either, so at this time there may not be a great solution to this problem, or at least not one that has been shared. What I ended up doing to work around this is to create two versions of the component, and use the rendered attribute to control which one is used, like this:
<p:selectBooleanButton
onLabel="Comment" offLabel="Comment"
onIcon="ui-icon-check" offIcon="ui-icon-close"
value="true" rendered="#{not empty myBean.comment}"
onchange="toggleDisplay(this.checked,'myForm:commentPanel');" />
<p:selectBooleanButton
onLabel="Comment" offLabel="Comment"
onIcon="ui-icon-check" offIcon="ui-icon-close"
value="false" rendered="#{empty myBean.comment}"
onchange="toggleDisplay(this.checked,'myForm:commentPanel');" />
i have a jsp page where i am displaying data in strust2 jquery Grid.
In grid column there is search facility based on the Select type(Drop down select).
<sjg:gridColumn name="subjectId" title="Subject Name" editable="true" align="center" search="true" searchtype="select"
searchoptions="{dataUrl:'%{selecturl}'}" edittype="select" editoptions="{dataUrl:'%{selecturl}'}" />
.My dropdown list is coming fine from my Class as well as it is correctly displaying on its place.
What i want exactly is a header value something like this ( ----select here--) followed by all the values populated from my class.
eg. I know how to do this(below code) in struts2 but i don't know this in struts2 jquery grid column.Now i am only able to display all list without header key & header values.
<s:select label="What's your favor search engine"
headerKey="-1" headerValue="----Select here----"
list="selecturl"
name="name" />
Please help me regarding this issue.