Help coderanch get a
new server
by contributing to the fundraiser

jackie parker

Greenhorn
+ Follow
since Mar 31, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 jackie parker

Thanks Tim i got that to work, i had a disable attribute which was reseting the value to the old one inspite of updating, and sorry for pasting the code in the text area. I had a follow up question on what you said about getting all the data at once, is it possible to at least show the selected value outside the datatable in a different output text based on the selection of the check box? If so could you give me a small snippet which would do that.

Thanks in advance
13 years ago
JSF
Hi,

I am new to JSF, and am in need of some advice on how to achieve the below requirement. I have a datatable, with input text(which displays a value from the DB) and a checkbox in each row. On checking the checkbox, the input text is enabled for editing, and on typing the new value and hitting the submit button outside the data table, the edited value is not being retained. Kindly let me know how this can be done(i need to be able to select multiple rows and then submit all at the same time). Here is the snippet of the jsf.


<h:dataTable bgcolor="White" id="pList" binding="#{MngdBean.pDataTable}"
var="pBean" value="#{MngdBean.pBeanList}"
width="100%"
border="0"
cellpadding="3"
cellspacing="0" >
<h:column>
<f:facet name="footer">
<h:outputLabel value="Min"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:inputText value="#{pBean.Min}" immediate="true"
size="4"
id="minInputText" converter="javax.faces.Integer"
disabled="true"
style="vertical-align:top;font-size:smaller;"
/>
</h:column>
<h:column>
<f:facet name="footer">
<h:outputLabel value="Max"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:inputText size="4" id="maxInputText" immediate="true"
style="vertical-align:top;"
disabled="true" converter="javax.faces.Integer"
value="#{pBean.Max}"
/>
</h:column>
<h:column>
<f:facet name="footer">
<h:outputLabel value="check1"
style="text-align:left; font-size:smaller;visibility:hidden;"/>
</f:facet>
<h:selectBooleanCheckbox id="check1"
style="align:center;"
onclick="addOnclickToDatatableRows(this)"
value="#{pBean.check1Selected}"/>
</h:column>
</h:dataTable>
</h:panelGroup>
<h:panelGroup id="panelGroup12">
<h:commandButton value="Submit"
id="save"
action="#{MngdBean.getSelectedEditedItems}" />
........

My backing bean has the following properties with getters/setters:

private List pBean;
private HtmlDataTable pDataTable;

When my action method in the backing bean gets called I see that the state of the dataTable reflects the state when it was created, not the state when the user clicked the commandButton (after they have edited some of the editable text fields).

What's the best way to get this state back into the backing bean so I can update my model?

I have already tried using immediate attribute. Can anyone give me inputs on how i can use the actionListeners (cmd button )/value change listeners(check box) to handle this? Do we need to implement processAction method for such a requirement.

Thanks in advance
13 years ago
JSF