Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7879927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:00:58+00:00 2026-06-03T04:00:58+00:00

I have a Primefaces dataTable with rowEdit. Two columns contain a selectOneMenu control in

  • 0

I have a Primefaces dataTable with rowEdit. Two columns contain a selectOneMenu control in each. First selectOneMenu has values SINGLE, MULTIPLE. If it is SINGLE, second column should contain selectOneMenu and if it is MULTIPLE, second column should contain pickList.
Initially second column is shown with selectOneMenu or pickList as per the value in value in first selectOneMenu that is set in the bean. But when user changes value in first selectOneMenu, I want either second selectOneMenu or pickList visible in second Column. This I tried using JQuery but not successful. Below is the code ……

<p:cellEditor>
<f:facet name="output">
     <h:outputLabel value="#{bean.INPUTTYPE}" />
    </f:facet>

<f:facet name="input">
        <p:selectOneMenu id="inputType" value="#{bean.InputType}" >
        <f:selectItems value="#{beanDetails.inputTypes}"></f:selectItems>
            <p:ajax event="change" oncomplete="inputTypeChanged(#{rowIndex})"/> 
        </p:selectOneMenu>
    </f:facet>
</p:cellEditor> 
</p:column>


<p:column>
    <f:facet name="header">
            <h:outputLabel value="Default Value" />
     </f:facet>

     <p:cellEditor>
    <f:facet name="output">
        <h:outputLabel value="#{bean.DEFAULTVALUE}"/>
    </f:facet>

    <f:facet name="input">
        <p:selectOneMenu id="distinctVals" value="#{bean.DEFAULTVALUE}" rendered="#{bean.fldType == 1}" >
            <f:selectItems value="#{bean.DISTINCT_VALUES}"/>
        </p:selectOneMenu>

        <p:pickList value="#{bean.PICK_VALUES}" id="pickVals" var="pickVals" itemLabel="#{pickVals}" itemValue="#{pickVals}" rendered="#{bean.fldType == 2}"/>
    </f:facet>   
</p:cellEditor> 
</p:column>


<script type="text/javascript">
    function inputTypeChanged(ind){
        var str = 'table_Details:' + ind + ':inputType_input';
        var selected = $(document.getElementById(str));

        if(selected.val() == 'SINGLE'){
            str = 'table_Details:' + ind + ':distinctVals_input';
                selected = $(document.getElementById(str));
                $(selected).show();

                str = 'table_Details:' + ind + ':pickVals_input';
                selected = $(document.getElementById(str));
                $(selected).fadeOut();
        }else if(selected.val() == 'MULTIPLE'){
                str = 'table_Details:' + ind + ':distinctVals_input';
                selected = $(document.getElementById(str));
                $(selected).fadeOut();

                str = 'table_Details:' + ind + ':pickVals_input';
                selected = $(document.getElementById(str));
                $(selected).fadeIn();

        }
    }
</script>

I am using primefaces-3.1.RC1. Anything wrong with my code ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:00:58+00:00Added an answer on June 3, 2026 at 4:00 am

    Inter dependent validations are handled in RowEditEvent

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Primefaces 3.0. I have a datatable with selectionMode single as shown
I have a question regarding primefaces datatable component. I want to bind a DataTable
I am new to jQuery. I have PrimeFaces dataTable. when it is converted to
I have a non-editable DataTable built with PrimeFaces. The table is initially filled with
I have a data table. Each row of the table has a commandButton called
I have a primefaces datatable: <p:dataTable id=idCrawledDataTable var=crawledData value=#{crawlerCorpusTreatmentBean.crawledDataModel} rowKey=#{crawledData.id} rows=10 scrollable=true scrollHeight=300 selection=#{crawlerCorpusTreatmentBean.crawledData}
I'm using primefaces and jstl to loop a datatable.I have a List in backing
I have a PrimeFaces dataTable that gets refreshed on actions of various controls of
Recently I switched to mojarra from myfaces and noticed that primefaces datatable checkbox multiple
I have an application that contains commandLinks within a Primefaces dataTable. The commandLinks link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.