0
votes

I have implemented primefaces roweditor for components like inputtext,autocomplete . I am trying to implement for selectmanymenu but could not get the result. If i use cell editor then i need to use input and output value should refer the same . Here selectmanymenu value would be the list not a single variable. So i am not sure how to handle it.

I would like know the proper implementation of p:selectManyMenu with p:cellEditor. I am not sure that we have option to do this also.

I have searched in stackoverflow as well as in google, did not get any answers for this.

Please help me out.

Below is the code details

<p:dataTable
    value="#{projectViewBean.projectListToEdit}"
    editable="true" var="proj" id="editProjLst">
     <p:ajax event="rowEdit" listener="#{projectEntryBean.onEdit}"/>
     <p:ajax event="rowEditInit" listener="#{projectEntryBean.onRowEditInit}"></p:ajax>
<p:column headerText="Project Status" id="sts">
        <p:cellEditor>
            <f:facet name="output">
                <p:outputLabel value="#{proj.projectStatus}"></p:outputLabel>
            </f:facet>
            <f:facet name="input">
                <p:selectOneMenu
                    value="#{proj.projectStatus}"
                    id="pjstval">
                    <f:selectItems value="#{projectEntryBean.projectStatusList}"
                        id="pjstlst" />
                </p:selectOneMenu>
            </f:facet>
        </p:cellEditor>
</p:column>
<p:column headerText="Phase" id="dbphase">
        <p:cellEditor>
            <f:facet name="output">
                <p:outputLabel value="#{proj.projectPhaseValue}"></p:outputLabel>
            </f:facet>
            <f:facet name="input">
                <p:autoComplete
                    completeMethod="#{projectEntryBean.autoSearchProjectPhase}"
                    value="#{proj.projectPhaseValue}"
                    dropdown="true" scrollHeight="200" emptyMessage="No Phase Found"
                    minQueryLength="1" forceSelection="true"></p:autoComplete>
            </f:facet>
        </p:cellEditor>
    </p:column>
<p:column headerText="Project Manager" id="pjtmgr">
        <p:cellEditor id="pm">
            <f:facet name="output">
                <p:outputLabel value="#{projectEntryBean.pjtView.projectUserList}"></p:outputLabel>
            </f:facet>
            <f:facet name="input">
                <p:selectManyMenu
                    value="#{proj.projectManager}"
                    id="projectmanagerval">
                    <f:selectItems value="#{projectEntryBean.pjtView.projectUserList}"
                        id="pmlst" />
                </p:selectManyMenu>
            </f:facet>
        </p:cellEditor>
    </p:column>
<p:column style="width:32px">
        <p:rowEditor />
    </p:column>
</p:dataTable>
1
please explain but could not get the result in words or through screenshot - Mahendran Ayyarsamy Kandiar
@MahendranAyyarsamyKandiar, Once i selected 2 values from the selectonemenu, it will be saved in DB Later when i want to retreive the same value in the format of datatable with row editor, selectmanymenu component has to show the value which is stored , but here it is not showing because facet output is label and facet input is list - Radhamani Muthusamy
@rao, Thanks for ur link. I always used to refer it. But there i see only for selectonemenu but no option for selectmanymenu - Radhamani Muthusamy
I was able to reproduce this issue. Open an issue here --> primefaces.org/issuetracker - Mahendran Ayyarsamy Kandiar
@MahendranAyyarsamyKandiar, Finally i got the solution and its working fine. i have posted the answer as well. Thanks for your help ! - Radhamani Muthusamy

1 Answers

1
votes

Finally i am able to achieve it by using converter. It might be helpful for someone. Please see the solution

<p:column headerText="Project Manager" id="pjtmgr">
    <p:cellEditor id="pm">
        <f:facet name="output">
            <p:outputLabel value="#{proj.projectManager}">
           <f:converter converterId="vendorConverter"></f:converter>
          </p:outputLabel>
        </f:facet>
        <f:facet name="input">
            <p:selectManyMenu
                value="#{proj.projectManager}"
                id="projectmanagerval">
                <f:selectItems value="#{projectEntryBean.pjtView.projectUserList}"
                    id="pmlst" />
            </p:selectManyMenu>
        </f:facet>
    </p:cellEditor>
</p:column>