-
1. Re: Issue in Using h:selectOnemenu inside richdatatable
nbelaevski Jul 2, 2011 5:08 PM (in response to puneet138)Hi Puneet,
Please post bean/page code.
-
2. Re: Issue in Using h:selectOnemenu inside richdatatable
dushyant_purohit Jul 4, 2011 5:38 AM (in response to nbelaevski)Hi Nick,
I am posting this on behalf of Puneet.
XHTML Code :
<h:form id="testDetailsForm">
<div id="testDetailsDiv" class="detailsDiv"
style="margin-top: 15px;">
<a4j:region>
<h:outputLabel id="testLabel" value="TEST" styleClass="key"></h:outputLabel>
<rich:dataTable id="testDetailsDataTable" binding="#{testDetailsHandler.testDetailsDataTable}"
var="testInfo" style="border-top:none;border-bottom:none;">
<rich:column id="testType" style="width:20%; vertical-align: top;" >
<h:selectOneMenu id="testDetailsTypeSelectMenu" binding="#{testDetailsHandler.testDetailsTypeSelectMenu}" style="width:100%;"
value="#{testInfo.TEST_PURPOSE_TYPE_ID}">
<f:selectItem binding="#{testDetailsHandler.testDetailsTypeSelectItem}" itemLabel="--Select--" itemValue="" ></f:selectItem>
</h:selectOneMenu>
</rich:column>
<rich:column id="testColumn" style="width:70%;">
<h:inputText id="testInputText" value="#{testInfo.TEST}" style="width:98%;"></h:inputText>
</rich:column>
</rich:dataTable>
</a4j:region>
</div>
</h:form>
Bean Code :
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.component.UISelectItem;
import javax.faces.component.html.HtmlInputHidden;
import javax.faces.component.html.HtmlSelectOneMenu;
import org.richfaces.component.UIDataTable;
@ManagedBean
@RequestScoped
public class TestDetails {
private UIDataTable testDetailsDataTable;
private HtmlSelectOneMenu testDetailsTypeSelectMenu;
private UISelectItem testDetailsTypeSelectItem;
public UIDataTable getTestDetailsDataTable() {
return testDetailsDataTable;
}
public void setTestDetailsDataTable(UIDataTable testDetailsDataTable) {
this.testDetailsDataTable = testDetailsDataTable;
}
public HtmlSelectOneMenu getTestDetailsTypeSelectMenu() {
return testDetailsTypeSelectMenu;
}
public void setTestDetailsTypeSelectMenu(
HtmlSelectOneMenu testDetailsTypeSelectMenu) {
this.testDetailsTypeSelectMenu = testDetailsTypeSelectMenu;
}
public UISelectItem getTestDetailsTypeSelectItem() {
return testDetailsTypeSelectItem;
}
public void setTestDetailsTypeSelectItem(
UISelectItem testDetailsTypeSelectItem) {
this.testDetailsTypeSelectItem = testDetailsTypeSelectItem;
}
}
The selectOneMenu is getting populated from the java layer. But the selected value and the value entered into the input text are not going to the java layer.
-
3. Re: Issue in Using h:selectOnemenu inside richdatatable
nbelaevski Jul 4, 2011 12:21 PM (in response to dushyant_purohit)How does TestInfo look like? Try adding rich:messages to the page and check if there are any,
-
4. Re: Issue in Using h:selectOnemenu inside richdatatable
dushyant_purohit Jul 5, 2011 9:19 AM (in response to nbelaevski)The testDetailsDataTable contains an arraylist of linked hashmaps. The var "testinfo" is mapped to a linked hashmap.
We did not find any messages even after implementing the rich:messages in the page.
The problem here is , we are able to see the rendered values in the UI for the same dataTable with the same bindings. But we are failing while trying
to get the values of this data table inside java layer.
-
5. Re: Issue in Using h:selectOnemenu inside richdatatable
nbelaevski Jul 5, 2011 2:00 PM (in response to dushyant_purohit)Where is data table value set? What's the scope of that value?
-
6. Re: Issue in Using h:selectOnemenu inside richdatatable
dushyant_purohit Jul 7, 2011 10:50 AM (in response to nbelaevski)The value is request scoped.
The data table value gets set in one handler.
Below is the code:
if(finalDetailsResult != null && finalDetailsResult.getTestDetails() != null){
finalDetailsResult.getTestDetails().add(testDetailsLinkedHashMap);
}
else{
testAL.add(testDetailsLinkedHashMap);
}
Here finalDetailsResult.getTestDetails() is an arrayList which is populated from testDetailsLinkedHashMap. testDetailsLinkedHashMap is mapped
to "testinfo". "If" block serves the purpose of showing existing details but for getting new information saved "else" block comes under picture.
testAL is a new arrayList.
Below is the exact code where the value of data table gets set which is followed after the code mentioned above.
if(finalDetailsResult.getTestDetails() != null){
if(testDetailsHandler.getTestDetailsDataTable()==null){
testDetailsHandler.setTestDetailsDataTable(StringUtil.getUIDataTable(finalDetailsResult.getTestDetails()));
}
else
{
testDetailsHandler.getTestDetailsDataTable().setValue(StringUtil.getArrayListForUIDataTable(finalDetailsResult.getTestDetails()));
}
}
else{
if(testDetailsHandler.getTestDetailsDataTable()==null){
testDetailsHandler.setTestDetailsDataTable(StringUtil.getUIDataTable(testAL));
}
else
{
testDetailsHandler.getTestDetailsDataTable().setValue(testAL);
}
}
-
7. Re: Issue in Using h:selectOnemenu inside richdatatable
nbelaevski Jul 7, 2011 2:14 PM (in response to dushyant_purohit)Please take a look if that's the case: https://issues.jboss.org/browse/RF-3314
-
8. Re: Issue in Using h:selectOnemenu inside richdatatable
puneet138 Jul 7, 2011 5:08 PM (in response to nbelaevski)Hi Nick,
The solution given at the link suggests using session scope beans. Is this the only solution? We would try to avoid keeping beans in session.
Thanks for your help.
Regards,
Puneet
-
9. Re: Issue in Using h:selectOnemenu inside richdatatable
dushyant_purohit Jul 8, 2011 7:41 AM (in response to nbelaevski)Hi Nick,
We have already tried with keeping the beans session scoped.
When we put the beans in session scope then the data table does not get rendered at all.
Regards,
Dushyant
-
10. Re: Issue in Using h:selectOnemenu inside richdatatable
nbelaevski Jul 8, 2011 1:18 PM (in response to dushyant_purohit)Not necessarily session scope, data table requires that data model is provided for subsequent requests only - take a look at the linked issue for details.
You can store query parameters and the re-fetch the data again.
-
11. Re: Issue in Using h:selectOnemenu inside richdatatable
puneet138 Jul 18, 2011 7:25 PM (in response to nbelaevski)Hi Nick,
We are not able to solve the issue. Would you please provide some example which shows that selectonemenu works in rich data table.
Thanks,
Puneet