Prakash Jebaraj

Greenhorn
+ Follow
since Mar 14, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prakash Jebaraj

I agree with Greg and Varun
18 years ago
JSF
Here is the client side code.

In the page bean, have a property to hold the count of rows displayed in the datatable and add inputHidden component in the form

<h:inputHidden id="countId" value="#{%pageBean%.%count%}"></h:inputHidden>


Add the below Javascript function

function selectAll(source) {
alert("Entered selectAll");

form = document.forms["%formId%"]; //replace %formId% with ur formId

var count = form["%formId%:countId"].value;

alert("count:"+count); //This gives count of rows

for(i=0; i < count; i++){
form["%formId%:%dataTableId%:" +i + ":%checkBoxId%"].checked = true;
}
}

function clearAll(source) {
alert("Entered clearAll");

form = document.forms["%formId%"]; //replace %formId% with ur formId

var count = form["%formId%:%checkBoxId%"].value; //replace %checkBoxId% with ur checkBoxId

alert("count:"+count); //This gives count of rows

for(i=0; i < count; i++){
form["%formId%:%dataTableId%:" +i + ":%checkBoxId%"].checked = false;
}
}
18 years ago
JSF
Hi Jesse,

You can add f:selectItem before f:selectItems tag like the following

<h:selectOneMenu rendered="#{userDataBean.user && !ReportDataBean.reportListEmpty}" value="#{ReportDataBean.item}" styleClass="optionValue">
<f:selectItem itemLabel="ALL ITEMS " itemValue="all" id="allItems"/>
<f:selectItems value="#{itemDataBean.itemList}"/>
</h:selectOneMenu>

Prakash
18 years ago
JSF
Hi,

<h:commandButton type="reset" /> will reset to previous values and not clear the values. So we have to reset to null in the backing bean as follows:

<h anelGrid styleClass="alignLeft">
<h:commandButton type="submit" value="Clear"
styleClass="commandExButton" id="id2"
actionListener="#{searchAgreement.clear}" />
</h anelGrid>

/**
* Action Listener method for clear action
*
* @param eActionEvent
*/
public void clear(ActionEvent e) {
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot uiViewRoot = facesContext.getViewRoot();
HtmlInputText inputText = null;
inputText = (HtmlInputText) uiViewRoot.findComponent("searchAgreement:agreementNumber");
inputText.setValue("");

inputText = (HtmlInputText) uiViewRoot.findComponent("searchAgreement:customerName");
inputText.setValue("");

inputText = (HtmlInputText) uiViewRoot.findComponent("searchAgreement:customerRefNumber");
inputText.setValue("");

inputText = (HtmlInputText) uiViewRoot.findComponent("searchAgreement:customerNumber");
inputText.setValue("");

inputText = (HtmlInputText) uiViewRoot.findComponent("searchAgreement:contactPhoneNumber");
inputText.setValue("");
}

hope this helps

Prakash
18 years ago
JSF
Hi,

Check whether you have added UserDirectory in the configuration.

Regards,
Prakash Jebaraj