You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Graeme Steyn <g....@cqu.edu.au> on 2008/07/15 12:57:42 UTC

[Trinidad] How to use PPR and a valueChangeEvent to update components in a tr:table row

Hi,

I have a table with a tr:inputText field that I have attached a jquery
autocomplete function to.  When the value of this input field changes, I
would like to do a PPR operation that updates corresponding hidden input
and select one choice components in the same row.  The code for the two
columns appears below.

Within the institutionValueChange event code, how would I access the
"constHep" and "constCntry" components to update their values and in the
case of the "constCntry" disable the component based on the new value.

Any points would be greatly appreciate.

Thank you.

Regards,

Graeme.

<tr:column>
     <f:facet name="header">
         <tr:panelHorizontalLayout
             valign="middle">
             <tr:image 
                 source="#{bundle.liveSearch}" 
                 styleClass="searchIco" 
                 shortDesc="#{bundle.iconLiveSearch}" />
             <tr:outputText value="#{bundle.eduInstitutionHeader}" />
         </tr:panelHorizontalLayout>
     </f:facet>
     <tr:panelHorizontalLayout
         valign="middle">
         <tr:inputHidden
             id="constHep"
             value="#{entry.institutionId}"
             partialTriggers="constInst" />
         
         <tr:inputText
             id="constInst"
             value="#{entry.institution}"
             immediate="true"
             autoSubmit="true"
             valueChangeListener="#{entry.institutionValueChange}" >
             <f:validateLength maximum="50" />
         </tr:inputText>
     </tr:panelHorizontalLayout>
 </tr:column>
 
 <tr:column >
     <f:facet name="header">
     </f:facet>
     
     <tr:selectOneChoice
         id="constCntry"
         partialTriggers="constInst"
         value="#{entry.country}" >
         <f:selectItems value="#{applicationSelectItems.countryList}" />
     </tr:selectOneChoice>
 </tr:column>


Graeme Steyn
Information Systems
Information Technology Division
CQUniversity
Tel: +61 7 4930 9256
Fax: +61 7 4930 6814
E-mail: g.steyn@cqu.edu.au


This e-mail message is intended only for the use of the individual or
entity to which it is addressed and may contain information that is
privileged, confidential and exempt from disclosure under applicable
law. If you are not the intended recipient, any dissemination,
distribution or copying of this communication is strictly prohibited. If
you have received this communication in error, please notify me
immediately by facsimile or telephone.


Re: [Trinidad] How to use PPR and a valueChangeEvent to update components in a tr:table row

Posted by Andrew Robinson <an...@gmail.com>.
Events in a table are fired in context, so you can access bound
component attributes in the correct context (assuming that you are
catching a value change event in a table child)

On Tue, Jul 15, 2008 at 7:46 PM, Graeme Steyn <g....@cqu.edu.au> wrote:
> Andrew, thank you.  I think the problem is in the actual value change
> event listener code.  I am not sure how to access or update the
> individual components.  The current code appears as follows:
>
>    public void institutionValueChange(ValueChangeEvent event) {
>
>        String newValue = (String) event.getNewValue();
>
>        UIXTable table = (UIXTable) constrainedTertiaryEducationTable;
>        TertiaryEducation row = (TertiaryEducation) table.getRowData();
>
>        if (newValue != null) {
>
>                // Find the hepCode value...
>
>            if (inHepList) {
>                row.setInstitutionId(hepCode);
>                row.setCountry(
>                        PeopleSoftConstants.AUSTRALIAN_COUNTRY_CODE);
>            }
>        } else {
>            row.setInstitutionId(null);
>        }
>
>        // Render response to prevent going to the validation phase for
> the
>        // other components. This prevents validation errors for the as
> yet
>        // incomplete fields.
>        getFacesContext().renderResponse();
>
>    }
>
> Basically, the row.set... operations are for updating the values in the
> other columns for the same row.  I would also have liked to do something
> along the lines of
>
> countryComponent.setDisabled(true);
>
> Unfortunately, I am not sure how this gets done without binding to the
> component in the backing bean, which I have being having problems with
> as well.  As you can see, I am a little new at trying to manipulate
> table contents using PPR.
>
> Regards,
>
> Graeme.
>
>> -----Original Message-----
>> From: Andrew Robinson
>> Sent: Wednesday, 16 July 2008 1:48 AM
>>
>> For access in the same row, what you have done looks correct to me.
>> Only when you want to go to a different row or from outside the table
>> into a row that it is a problem (must be handled with code). Can you
>> check using firebug if the HTML is being sent down for the two
>> components?
>>
>> -Andrew
>>
>> On Tue, Jul 15, 2008 at 4:57 AM, Graeme Steyn <g....@cqu.edu.au>
>> wrote:
>> > Hi,
>> >
>> > I have a table with a tr:inputText field that I have attached a
>> jquery
>> > autocomplete function to.  When the value of this input field
>> changes, I
>> > would like to do a PPR operation that updates corresponding hidden
>> input
>> > and select one choice components in the same row.  The code for the
>> two
>> > columns appears below.
>> >
>> > Within the institutionValueChange event code, how would I access the
>> > "constHep" and "constCntry" components to update their values and in
>> the
>> > case of the "constCntry" disable the component based on the new
>> value.
>> >
>> > Any points would be greatly appreciate.
>> >
>> > Thank you.
>> >
>> > Regards,
>> >
>> > Graeme.
>> >
>> > <tr:column>
>> >     <f:facet name="header">
>> >         <tr:panelHorizontalLayout
>> >             valign="middle">
>> >             <tr:image
>> >                 source="#{bundle.liveSearch}"
>> >                 styleClass="searchIco"
>> >                 shortDesc="#{bundle.iconLiveSearch}" />
>> >             <tr:outputText value="#{bundle.eduInstitutionHeader}" />
>> >         </tr:panelHorizontalLayout>
>> >     </f:facet>
>> >     <tr:panelHorizontalLayout
>> >         valign="middle">
>> >         <tr:inputHidden
>> >             id="constHep"
>> >             value="#{entry.institutionId}"
>> >             partialTriggers="constInst" />
>> >
>> >         <tr:inputText
>> >             id="constInst"
>> >             value="#{entry.institution}"
>> >             immediate="true"
>> >             autoSubmit="true"
>> >             valueChangeListener="#{entry.institutionValueChange}" >
>> >             <f:validateLength maximum="50" />
>> >         </tr:inputText>
>> >     </tr:panelHorizontalLayout>
>> >  </tr:column>
>> >
>> >  <tr:column >
>> >     <f:facet name="header">
>> >     </f:facet>
>> >
>> >     <tr:selectOneChoice
>> >         id="constCntry"
>> >         partialTriggers="constInst"
>> >         value="#{entry.country}" >
>> >         <f:selectItems value="#{applicationSelectItems.countryList}"
>> />
>> >     </tr:selectOneChoice>
>> >  </tr:column>
>> >
>> >
>> > Graeme Steyn
>> > Information Systems
>> > Information Technology Division
>> > CQUniversity
>> > Tel: +61 7 4930 9256
>> > Fax: +61 7 4930 6814
>> > E-mail: g.steyn@cqu.edu.au
>> >
>> >
>> > This e-mail message is intended only for the use of the individual
> or
>> > entity to which it is addressed and may contain information that is
>> > privileged, confidential and exempt from disclosure under applicable
>> > law. If you are not the intended recipient, any dissemination,
>> > distribution or copying of this communication is strictly
> prohibited.
>> If
>> > you have received this communication in error, please notify me
>> > immediately by facsimile or telephone.
>> >
>> >
>

RE: [Trinidad] How to use PPR and a valueChangeEvent to update components in a tr:table row

Posted by Graeme Steyn <g....@cqu.edu.au>.
Andrew, thank you.  I think the problem is in the actual value change
event listener code.  I am not sure how to access or update the
individual components.  The current code appears as follows:

    public void institutionValueChange(ValueChangeEvent event) {

        String newValue = (String) event.getNewValue();

        UIXTable table = (UIXTable) constrainedTertiaryEducationTable;
        TertiaryEducation row = (TertiaryEducation) table.getRowData();

        if (newValue != null) {

		// Find the hepCode value...

            if (inHepList) {
                row.setInstitutionId(hepCode);
                row.setCountry(
                        PeopleSoftConstants.AUSTRALIAN_COUNTRY_CODE);
            }
        } else {
            row.setInstitutionId(null);
        }

        // Render response to prevent going to the validation phase for
the
        // other components. This prevents validation errors for the as
yet
        // incomplete fields.
        getFacesContext().renderResponse();

    }

Basically, the row.set... operations are for updating the values in the
other columns for the same row.  I would also have liked to do something
along the lines of

countryComponent.setDisabled(true);

Unfortunately, I am not sure how this gets done without binding to the
component in the backing bean, which I have being having problems with
as well.  As you can see, I am a little new at trying to manipulate
table contents using PPR.

Regards,

Graeme.

> -----Original Message-----
> From: Andrew Robinson 
> Sent: Wednesday, 16 July 2008 1:48 AM
> 
> For access in the same row, what you have done looks correct to me.
> Only when you want to go to a different row or from outside the table
> into a row that it is a problem (must be handled with code). Can you
> check using firebug if the HTML is being sent down for the two
> components?
> 
> -Andrew
> 
> On Tue, Jul 15, 2008 at 4:57 AM, Graeme Steyn <g....@cqu.edu.au>
> wrote:
> > Hi,
> >
> > I have a table with a tr:inputText field that I have attached a
> jquery
> > autocomplete function to.  When the value of this input field
> changes, I
> > would like to do a PPR operation that updates corresponding hidden
> input
> > and select one choice components in the same row.  The code for the
> two
> > columns appears below.
> >
> > Within the institutionValueChange event code, how would I access the
> > "constHep" and "constCntry" components to update their values and in
> the
> > case of the "constCntry" disable the component based on the new
> value.
> >
> > Any points would be greatly appreciate.
> >
> > Thank you.
> >
> > Regards,
> >
> > Graeme.
> >
> > <tr:column>
> >     <f:facet name="header">
> >         <tr:panelHorizontalLayout
> >             valign="middle">
> >             <tr:image
> >                 source="#{bundle.liveSearch}"
> >                 styleClass="searchIco"
> >                 shortDesc="#{bundle.iconLiveSearch}" />
> >             <tr:outputText value="#{bundle.eduInstitutionHeader}" />
> >         </tr:panelHorizontalLayout>
> >     </f:facet>
> >     <tr:panelHorizontalLayout
> >         valign="middle">
> >         <tr:inputHidden
> >             id="constHep"
> >             value="#{entry.institutionId}"
> >             partialTriggers="constInst" />
> >
> >         <tr:inputText
> >             id="constInst"
> >             value="#{entry.institution}"
> >             immediate="true"
> >             autoSubmit="true"
> >             valueChangeListener="#{entry.institutionValueChange}" >
> >             <f:validateLength maximum="50" />
> >         </tr:inputText>
> >     </tr:panelHorizontalLayout>
> >  </tr:column>
> >
> >  <tr:column >
> >     <f:facet name="header">
> >     </f:facet>
> >
> >     <tr:selectOneChoice
> >         id="constCntry"
> >         partialTriggers="constInst"
> >         value="#{entry.country}" >
> >         <f:selectItems value="#{applicationSelectItems.countryList}"
> />
> >     </tr:selectOneChoice>
> >  </tr:column>
> >
> >
> > Graeme Steyn
> > Information Systems
> > Information Technology Division
> > CQUniversity
> > Tel: +61 7 4930 9256
> > Fax: +61 7 4930 6814
> > E-mail: g.steyn@cqu.edu.au
> >
> >
> > This e-mail message is intended only for the use of the individual
or
> > entity to which it is addressed and may contain information that is
> > privileged, confidential and exempt from disclosure under applicable
> > law. If you are not the intended recipient, any dissemination,
> > distribution or copying of this communication is strictly
prohibited.
> If
> > you have received this communication in error, please notify me
> > immediately by facsimile or telephone.
> >
> >

Re: [Trinidad] How to use PPR and a valueChangeEvent to update components in a tr:table row

Posted by Andrew Robinson <an...@gmail.com>.
For access in the same row, what you have done looks correct to me.
Only when you want to go to a different row or from outside the table
into a row that it is a problem (must be handled with code). Can you
check using firebug if the HTML is being sent down for the two
components?

-Andrew

On Tue, Jul 15, 2008 at 4:57 AM, Graeme Steyn <g....@cqu.edu.au> wrote:
> Hi,
>
> I have a table with a tr:inputText field that I have attached a jquery
> autocomplete function to.  When the value of this input field changes, I
> would like to do a PPR operation that updates corresponding hidden input
> and select one choice components in the same row.  The code for the two
> columns appears below.
>
> Within the institutionValueChange event code, how would I access the
> "constHep" and "constCntry" components to update their values and in the
> case of the "constCntry" disable the component based on the new value.
>
> Any points would be greatly appreciate.
>
> Thank you.
>
> Regards,
>
> Graeme.
>
> <tr:column>
>     <f:facet name="header">
>         <tr:panelHorizontalLayout
>             valign="middle">
>             <tr:image
>                 source="#{bundle.liveSearch}"
>                 styleClass="searchIco"
>                 shortDesc="#{bundle.iconLiveSearch}" />
>             <tr:outputText value="#{bundle.eduInstitutionHeader}" />
>         </tr:panelHorizontalLayout>
>     </f:facet>
>     <tr:panelHorizontalLayout
>         valign="middle">
>         <tr:inputHidden
>             id="constHep"
>             value="#{entry.institutionId}"
>             partialTriggers="constInst" />
>
>         <tr:inputText
>             id="constInst"
>             value="#{entry.institution}"
>             immediate="true"
>             autoSubmit="true"
>             valueChangeListener="#{entry.institutionValueChange}" >
>             <f:validateLength maximum="50" />
>         </tr:inputText>
>     </tr:panelHorizontalLayout>
>  </tr:column>
>
>  <tr:column >
>     <f:facet name="header">
>     </f:facet>
>
>     <tr:selectOneChoice
>         id="constCntry"
>         partialTriggers="constInst"
>         value="#{entry.country}" >
>         <f:selectItems value="#{applicationSelectItems.countryList}" />
>     </tr:selectOneChoice>
>  </tr:column>
>
>
> Graeme Steyn
> Information Systems
> Information Technology Division
> CQUniversity
> Tel: +61 7 4930 9256
> Fax: +61 7 4930 6814
> E-mail: g.steyn@cqu.edu.au
>
>
> This e-mail message is intended only for the use of the individual or
> entity to which it is addressed and may contain information that is
> privileged, confidential and exempt from disclosure under applicable
> law. If you are not the intended recipient, any dissemination,
> distribution or copying of this communication is strictly prohibited. If
> you have received this communication in error, please notify me
> immediately by facsimile or telephone.
>
>