1 2 3 4 Previous Next 55 Replies Latest reply: Dec 18, 2012 3:52 AM by Tshifhiwa RSS

    cascading lov using bean not passing selected LOV value

    Tshifhiwa
      cascading lov using bean not passing selected parameter value to second LOV
      hi all i have use case,am creating cascading LOV using this sample http://mjabr.wordpress.com/2011/04/01/cascade-list-of-values/ when i test is ok no problem but when i run it in my jsff page am not geting value of second LOV BASED ON THE FIRST SELECETION LOV,am in jdeveloper 11.1.1.6.0
       <af:selectOneChoice
                                              label="#{bindings.LutOrganisationtypesView1.label}"
                                              required="true"
                                              shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                              id="soc2" simple="true"
                                              autoSubmit="true"
                                              immediate="true"
                                              binding="#{pageFlowScope.orgDetailsBean.orgCat}"
                                              value="#{pageFlowScope.orgDetailsBean.orgCat}">
                      
                           <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                        var="row">
                              <af:selectItem id="tiltco2" label="#{row.description}"
                                             value="#{row.organisationtypecode}"/>
                            </af:forEach>                 
                          </af:selectOneChoice>
                        
                        </td>
                      </tr><tr>
                        <td width="50%" height="22">
                          <af:outputLabel value="Type" id="ol5" showRequired="true"/>
                        </td>
                        <td width="50%" height="22">
                          <af:selectOneChoice value="#{pageFlowScope.orgDetailsBean.orgSubtype}"
                                              label="#{bindings.LutOrgsubtypesView1.label}"
                                              required="true"
                                              shortDesc="#{bindings.LutOrgsubtypesView1.hints.tooltip}"
                                              id="soc1" simple="true"
                                              autoSubmit="true"
                                              binding="#{pageFlowScope.orgDetailsBean.orgSubtype}"
                                              partialTriggers="soc2" immediate="true">
                         
                                            <af:forEach items="#{bindings.LutOrgsubtypesView1.iteratorBinding.allRowsInRange}"
                                        var="row">
                              <af:selectItem id="tiltcos2" label="#{row.orgsubtypename}"
                                             value="#{row.orgsubtypecode}"/>
                            </af:forEach>      
                          </af:selectOneChoice>
                        </td>
                      </tr><tr>
                        <td width="50%" height="19" nowrap="nowrap">
                          <af:outputLabel value="Registration Number " id="ol6"
                                          partialTriggers="soc2"
                                          showRequired="#{pageFlowScope.orgDetailsBean.orgCat.value!='GOVT '}"/>
                        </td>
                        <td width="50%" height="19">
                          <af:inputText label="Registration Number " id="it2" columns="20"
                                        partialTriggers="soc2"
                                        required="#{pageFlowScope.orgDetailsBean.orgCat.value!='GOVT '}"
                                        disabled="#{pageFlowScope.orgDetailsBean.orgCat.value=='GOVT '}"
                                        autoSubmit="true"
                                        binding="#{pageFlowScope.orgDetailsBean.regNumber}"
                                        readOnly="false" immediate="true"
                                        simple="true"/>
                        </td>
      am alos geting this error when make selection
      cannot convert PRIV of type class java.lang.string to class to class oracle.adf.view.rich.component.rich.input.RichSelectOnechoice, PRIV is the paramemter cod am passing to second LOV.
      i try to use this sample http://adfdeveloper.blogspot.com/2011/03/cascading-dropdown-list-from-bean.html,the thing is am using the bean,i what to know how will i do cascading LOV in bean,in this sample there is class SelecteItem define i don't where was it define

      my bean is define like this
      public class testlov{
          private String orgSubtype;
          private String category;
          private RichSelectOneChoice orgCat;
          public testlov() {
              super();
          }
         public void setOrgCat(RichSelectOneChoice orgCat) {
             this.orgCat = orgCat;
         }
      
         public RichSelectOneChoice getOrgCat() {
             return orgCat;
         }
          public void setOrgSubtype(String orgSubtype) {
              this.orgSubtype = orgSubtype;
          }
      
          public String getOrgSubtype() {
              return orgSubtype;
          }
      this is how my LOV view define
      <?xml version="1.0" encoding="windows-1252" ?>
      <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
      <!---->
      <ViewObject
        xmlns="http://xmlns.oracle.com/bc4j"
        Name="OrgSubTypeViewVO"
        Version="11.1.1.61.92"
        InheritPersonalization="true"
        BindingStyle="OracleName"
        CustomQuery="true"
        PageIterMode="Full"
        UseGlueCode="false">
        <DesignTime>
          <Attr Name="_isExpertMode" Value="true"/>
        </DesignTime>
        <Properties>
          <SchemaBasedProperties>
            <LABEL
              ResId="test.lov.views.OrgSubTypeViewVO_LABEL"/>
          </SchemaBasedProperties>
        </Properties>
        <Variable
          Name="orgtypeID"
          Kind="where"
          Type="java.lang.String"/>
        <ViewAccessor
          Name="OrgSubTypeViewVO1"
          ViewObjectName="test.lov.views.OrgSubTypeViewVO"
          RowLevelBinds="true"/>
        <ListBinding
          Name="LOV_Orgsubtypecode"
          ListVOName="OrgSubTypeViewVO1"
          ListRangeSize="-1"
          NullValueFlag="start"
          NullValueId="${adfBundle['oracle.javatools.resourcebundle.SystemBundle']['NULL_VALUE_RESID']}"
          MRUCount="0">
          <AttrArray Name="AttrNames">
            <Item Value="Orgsubtypecode"/>
          </AttrArray>
          <AttrArray Name="ListAttrNames">
            <Item Value="Orgsubtypecode"/>
          </AttrArray>
          <AttrArray Name="ListDisplayAttrNames">
            <Item Value="Orgsubtypename"/>
          </AttrArray>
          <DisplayCriteria/>
        </ListBinding>
        <SQLQuery>
          <![CDATA[SELECT 
          LUT_ORGSUBTYPES.ORGSUBTYPECODE ORGSUBTYPECODE, 
          LUT_ORGSUBTYPES.ORGSUBTYPENAME ORGSUBTYPENAME, 
          LUT_ORGSUBTYPES.ORGANISATIONTYPECODE ORGANISATIONTYPECODE 
      FROM 
          LUT_ORGSUBTYPES where    LUT_ORGSUBTYPES.ORGANISATIONTYPECODE = :orgtypeID]]>
        </SQLQuery>
        <ViewAttribute
          Name="Orgsubtypecode"
          IsUpdateable="false"
          IsPersistent="false"
          IsNotNull="true"
          PrecisionRule="true"
          Precision="255"
          Type="java.lang.String"
          ColumnType="VARCHAR2"
          AliasName="ORGSUBTYPECODE"
          Expression="ORGSUBTYPECODE"
          SQLType="CHAR"
          LOVName="LOV_Orgsubtypecode">
          <DesignTime>
            <Attr Name="_DisplaySize" Value="50"/>
          </DesignTime>
          <Properties>
            <SchemaBasedProperties>
              <CONTROLTYPE
                Value="choice"/>
            </SchemaBasedProperties>
          </Properties>
        </ViewAttribute>
        <ViewAttribute
          Name="Orgsubtypename"
          IsUpdateable="false"
          IsPersistent="false"
          IsNotNull="true"
          PrecisionRule="true"
          Precision="60"
          Type="java.lang.String"
          ColumnType="VARCHAR2"
          AliasName="ORGSUBTYPENAME"
          Expression="ORGSUBTYPENAME"
          SQLType="VARCHAR">
          <DesignTime>
            <Attr Name="_DisplaySize" Value="60"/>
          </DesignTime>
        </ViewAttribute>
        <ViewAttribute
          Name="Organisationtypecode"
          IsUpdateable="false"
          IsPersistent="false"
          IsNotNull="true"
          PrecisionRule="true"
          Precision="5"
          Type="java.lang.String"
          ColumnType="CHAR"
          AliasName="ORGANISATIONTYPECODE"
          Expression="ORGANISATIONTYPECODE"
          SQLType="CHAR">
          <DesignTime>
            <Attr Name="_DisplaySize" Value="5"/>
          </DesignTime>
        </ViewAttribute>
        <ResourceBundle>
          <PropertiesBundle
            PropertiesFile="model.ModelBundle"/>
        </ResourceBundle>
      </ViewObject>
      am storing the LOV VALUES in this view varianle/column
      <ViewAttribute
          Name="Orgsubtypecode"
          IsNotNull="true"
          PrecisionRule="true"
          EntityAttrName="Orgsubtypecode"
          EntityUsage="UamOrganisations"
          AliasName="ORGSUBTYPECODE"
          LOVName="LOV_Orgsubtypecode">
          <Properties>
            <SchemaBasedProperties>
              <CONTROLTYPE
                Value="choice"/>
            </SchemaBasedProperties>
          </Properties>
        </ViewAttribute>
        <ViewAttribute
          Name="Organisationtypecode"
          PrecisionRule="true"
          EntityAttrName="Organisationtypecode"
          EntityUsage="UamOrganisations"
          AliasName="ORGANISATIONTYPECODE"
          LOVName="LOV_Organisationtypecode">
          <Properties>
            <SchemaBasedProperties>
              <AUTOSUBMIT
                Value="true"/>
              <CONTROLTYPE
                Value="choice"/>
            </SchemaBasedProperties>
          </Properties>
        </ViewAttribute>
      Edited by: adf0994 on 2012/11/07 2:55 PM

      Edited by: adf0994 on 2012/11/07 3:08 PM

      Edited by: adf0994 on 2012/11/08 11:23 AM

      Edited by: adf0994 on 2012/11/08 11:24 AM

      Edited by: adf0994 on 2012/11/08 12:12 PM

      Edited by: adf0994 on 2012/11/23 2:26 PM
        • 1. Re: cascading lov using bean
          user404
          Try to set the first immediate to false
          • 2. Re: cascading lov using bean
            Tshifhiwa
            i did is not working,its only making one selection,its not making available selection choose of second lov based on the first selected choose,AM I CLEAR
            <af:selectOneChoice
                                                    label="#{bindings.LutOrganisationtypesView1.label}"
                                                    required="true"
                                                    shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                                    id="soc2" simple="true"
                                                    autoSubmit="true"
                                                    immediate="false"
                                                    binding="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                    value="#{pageFlowScope.orgDetailsBean.orgCat}">
                            
                                 <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                              var="row">
                                    <af:selectItem id="tiltco2" label="#{row.description}"
                                                   value="#{row.organisationtypecode}"/>
                                  </af:forEach>                 
                                </af:selectOneChoice>
            Edited by: adf0994 on 2012/11/07 2:39 PM

            Edited by: adf0994 on 2012/11/07 3:10 PM
            • 3. Re: cascading lov using bean
              user404
              Are you sure that the data for your second LOV contains the correct data after you selected something from the first LOV?
              • 4. Re: cascading lov using bean
                Tshifhiwa
                the second LOV is correct is displaying data of one selection i make from first LOV,but when i make diffirent selection am not able to see the value of that other selection in the second LOV,the second LOV IS SHOWING only one selected choose from parent LOV

                Edited by: adf0994 on 2012/11/07 5:16 PM
                • 5. Re: cascading lov using bean
                  user404
                  When you select an item from your first LOV, you need to change the List (or whatever you are using in your bean) that you use for your second bean.
                  You can use the attributeChangeListener (for your first LOV). When you select an item in your first LOV, the listener will activate and in that method in your bean, you need to populate the List for your second LOV.
                  If that still doesn't work, add this at the end of your listener method :
                  AdfFacesContext.getCurrentInstance().addPartialTarget( componenintBindingVariable );
                  • 6. Re: cascading lov using bean
                    Tshifhiwa
                    how do i implemnt attributeChangeListener i don't see option for attributeChangeListener in my component palletter->operation am in jdeveloper 11.1.1.6.0,and what method in my bean the listener will activate

                    Edited by: adf0994 on 2012/11/07 5:32 PM
                    • 7. Re: cascading lov using bean
                      user404
                      I'm not 100% sure if it's possible in your JDev version.
                      It should be under the 'Advanced' section in the Property Window.

                      Ex:
                      <af:selectOneChoice value="#{bindings.ContactView1.inputValue}" label="#{bindings.ContactView1.label}"
                                                    required="#{bindings.ContactView1.hints.mandatory}"
                                                    shortDesc="#{bindings.ContactView1.hints.tooltip}" id="soc3"
                                                    attributeChangeListener="#{pageFlowScope.ReferenceBean.listener}">
                                  <f:selectItems value="#{bindings.ContactView1.items}" id="si3"/>
                                </af:selectOneChoice>
                      • 8. Re: cascading lov using bean
                        Tshifhiwa
                        if i may ask what kind of method is this ReferenceBean.listener in attributeChangeListener="#{pageFlowScope.ReferenceBean.listener}"> i don't have that method in my class. ok i got attributeActionListner under advannce but the problem where will i get the method .listener
                        this is what i have done so far and is still not working
                        <af:selectOneChoice
                                                                label="#{bindings.LutOrganisationtypesView1.label}"
                                                                required="true"
                                                                shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                                                id="soc2" simple="true"
                                                                autoSubmit="true"
                                                                immediate="true"
                                                                binding="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                value="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                attributeChangeListener="#{pageFlowScope.ReferenceBean.listener}">
                                        
                                             <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                                          var="row">
                                                <af:selectItem id="tiltco2" label="#{row.description}"
                                                               value="#{row.organisationtypecode}"/>
                                              </af:forEach>                 
                                            </af:selectOneChoice>
                        Edited by: adf0994 on 2012/11/07 5:41 PM

                        Edited by: adf0994 on 2012/11/07 5:44 PM
                        • 9. Re: cascading lov using bean
                          user404
                          Select your LOV (in source or design view).
                          Go to the property window and scroll down to the advanced part.
                          Press the little arrow on the right of 'attributeChangeListener' and press 'Edit'.
                          In the popup, choose your Bean and Press 'New' next to 'Method'.
                          • 10. Re: cascading lov using bean not passing selected parameter value
                            Tshifhiwa
                            ok this is my listner method
                               private RichSelectOneChoice orgCat;
                               public void setOrgCat(RichSelectOneChoice orgCat) {
                                   this.orgCat = orgCat;
                               }
                            
                               public RichSelectOneChoice getOrgCat() {
                                   return orgCat;
                               }
                                public void listener(AttributeChangeEvent attributeChangeEvent) {
                                    // Add event code here...
                                    AdfFacesContext.getCurrentInstance().addPartialTarget( componenintBindingVariable );
                                }
                            where does componenintBindingVariable define
                            
                            
                            
                                   public void listener(AttributeChangeEvent attributeChangeEvent) {
                                   
                                    AdfFacesContext.getCurrentInstance().addPartialTarget(orgCat);
                                }
                            not passing value to second LOV,I only get the list of one seleted value of first LOV,WHICH IS BEEN PASSED TO SECOND lov
                                
                            my first LOV IS
                            <af:selectOneChoice
                                                                    label="#{bindings.LutOrganisationtypesView1.label}"
                                                                    required="true"
                                                                    shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                                                    id="soc2" simple="true"
                                                                    autoSubmit="true"
                                                                    immediate="true"
                                                                    binding="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                    value="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                    attributeChangeListener="#{pageFlowScope.orgDetailsBean.listener}">
                                            
                                                 <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                                              var="row">
                                                    <af:selectItem id="tiltco2" label="#{row.description}"
                                                                   value="#{row.organisationtypecode}"/>
                                                  </af:forEach>                 
                                                </af:selectOneChoice>
                            
                            my second LOV IS
                            <af:selectOneChoice
                                                                    label="#{bindings.LutOrgsubtypesView1.label}"
                                                                    required="true"
                                                                    shortDesc="#{bindings.LutOrgsubtypesView1.hints.tooltip}"
                                                                    id="soc1" simple="true"
                                                                    autoSubmit="false"
                                                                    partialTriggers="soc2"
                                                                    immediate="true"
                                                                    binding="#{pageFlowScope.orgDetailsBean.textLOVSingle}"
                                                                    value="#{pageFlowScope.orgDetailsBean.orgSubtype}">
                                               
                                                                  <af:forEach items="#{bindings.LutOrgsubtypesView1.iteratorBinding.allRowsInRange}"
                                                              var="row">
                                                    <af:selectItem id="tiltcos2" label="#{row.orgsubtypename}"
                                                                   value="#{row.orgsubtypecode}"/>
                                                  </af:forEach>      
                                                </af:selectOneChoice>
                            am geting this error when i try to select another choose from first LOV,this LOV choose value are the one not displaying in the second LOV,
                            cannot convert PRIV of type class java.lang.string to class to class oracle.adf.view.rich.component.rich.input.RichSelecteOnechoice in adf.AM I clear,how can I populate the List for MY second LOV,based on the first LOV SELECTION using bean

                            MY LOG FILE SHOW <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]


                            Edited by: adf0994 on 2012/11/08 11:22 AM

                            Edited by: adf0994 on 2012/11/08 2:49 PM

                            Edited by: adf0994 on 2012/11/08 4:25 PM

                            Edited by: adf0994 on 2012/11/08 5:40 PM
                            • 11. Re: cascading lov using bean not passing selected parameter value
                              user404
                              I don't want to be rude but do you have any experiance with Java/ADF ?
                              Because you are trying to do weird stuff in your page/bean.

                              You have 2 LOV's who get their data from a bean and for some reason you try to get data from a View Object (see listener method)?

                              For 'componenintBindingVariable', that is just a binding from your LOV2 to your bean (property window > binding). The 'name' of that binding you need to replace with 'componenintBindingVariable'
                              • 12. Re: cascading lov using bean not passing selected parameter value
                                Tshifhiwa
                                hi i have change my listner method is this ok check below,please help am Drowning ,just need your direction,i have idea what to do but don't know how,lets share knowledge
                                ok you mean like this ,is still not working please can you help what am i missing
                                    public void listener(AttributeChangeEvent attributeChangeEvent) {
                                        // Add event code here...
                                       
                                        AdfFacesContext.getCurrentInstance().addPartialTarget( orgCat );
                                    }
                                
                                <af:selectOneChoice
                                                                        label="#{bindings.LutOrganisationtypesView1.label}"
                                                                        required="true"
                                                                        shortDesc="#{bindings.LutOrganisationtypesView1.hints.tooltip}"
                                                                        id="soc2" simple="true"
                                                                        autoSubmit="true"
                                                                        immediate="true"
                                                                        binding="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                        value="#{pageFlowScope.orgDetailsBean.orgCat}"
                                                                        rendered="true" valuePassThru="true"
                                                                                                  attributeChangeListener="#{pageFlowScope.orgDetailsBean.listener}">
                                                
                                                     <af:forEach items="#{bindings.LutOrganisationtypesView1.iteratorBinding.allRowsInRange}"
                                                                  var="row">
                                                        <af:selectItem id="tiltco2" label="#{row.description}"
                                                                       value="#{row.organisationtypecode}"/>
                                                      </af:forEach>                 
                                                    </af:selectOneChoice>
                                my log file error is showing this
                                <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc2]
                                <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "RichSelectOneChoice[UIXEditableFacesBeanImpl, id=null]" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc1]

                                Edited by: adf0994 on 2012/11/08 5:28 PM
                                • 13. Re: cascading lov using bean not passing selected parameter value
                                  user404
                                  Can you show us the code you use for getting your data? For example this lists in your bean
                                  • 14. Re: cascading lov using bean not passing selected parameter value
                                    Tshifhiwa
                                    ok my bean class is
                                    public class LOVTEST {
                                        private String orgSubtype;
                                        private RichSelectOneChoice orgCat;
                                       private Map<String, List <SelectItem>> _itemMapList = new HashMap<String, List<SelectItem>>(); 
                                        public  LOVTEST() {
                                            super();
                                        }
                                        public void setOrgSubtype(String orgSubtype) {
                                            this.orgSubtype = orgSubtype;
                                        }
                                    
                                        public String getOrgSubtype() {
                                            return orgSubtype;
                                        }
                                       public void setOrgCat(RichSelectOneChoice orgCat) {
                                           this.orgCat = orgCat;
                                       }
                                    
                                       public RichSelectOneChoice getOrgCat() {
                                           return orgCat;
                                       }
                                    }
                                    am trying to do this for cascading lov in bean,at the moment is using a view,can u show me how can i do it in bean
                                        public List<SelectItem>retriveItems(String orgCat ){
                                            if (_itemMapList.containsKey(orgCat)) {
                                                return _itemMapList.get(orgCat);          
                                            }
                                            else
                                            {
                                                List<SelectItem> list = new ArrayList<SelectItem>();
                                                list.add(new SelectItem(null, ""));
                                                
                                                List<UamOrganisationsViewRowImpl> result = this.retrivecatagorylistfromdatasource(orgCat);
                                                
                                                
                                                for (UamOrganisationsViewRowImpl item : result) {
                                                    list.add(new SelectItem(), item.getOrganisationtypecode());
                                                }
                                                _itemMapList.put(orgCat, list);
                                                return list;
                                            }
                                            
                                        }  
                                     public List GetItems(){
                                             
                                             String item = (String)this.resolveExpression("#(row.organisationtypecode)");
                                             
                                             OrgDetails org = (OrgDetails)AdfFacesContext.getCurrentInstance().getPageFlowScope().get("orgCat");
                                             return  org.retriveItems(item);
                                             
                                         }
                                    i was trying to follow this sample
                                    http://adfdeveloper.blogspot.com/2011/03/cascading-dropdown-list-from-bean.html
                                    Edited by: adf0994 on 2012/11/09 8:41 AM

                                    Edited by: adf0994 on 2012/11/09 8:45 AM

                                    Edited by: adf0994 on 2012/11/09 8:52 AM
                                    1 2 3 4 Previous Next