You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2007/08/08 09:29:33 UTC

[Trinidad] PPR from table cells failure

Hi, I wonder how I can trigger PPR from inside a table cell, since it 
appears not working - I guess because of some id mismatch.
I have something like:

<tr:table ...
    <tr:column>
          <tr:commandLink id="suggester" partialSubmit="true"...
    ...
    </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="suggester">

then I get a warning from Trinidad as soon as I click on any table link:

Could not find partial trigger suggester from 
CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]

However, if I place the trigger component also outside the table, then 
PPR works properly and there is no warning., even while clicking on any 
link inside the table.
I guess this issue has something to do with real trigger name, which is 
<container>:<rowIndex>:suggester, but I thought Trinidad should take 
care of matching these ids against a partialTrigger attribute. If not, 
how can I workaround it ?

-- Renzo


Re: [Trinidad] PPR from table cells failure

Posted by Adam Winer <aw...@gmail.com>.
User code should almost never call partialUpdateNotify(), just
addPartialTarget().  And I doubt the renderResponse() call
is relevant either.

The real thing is just that you have to include the id of the
table in partialTriggers:

<tr:table id="theTable">
   <tr:column>
         <tr:commandLink id="suggester" partialSubmit="true"...
   ...
   </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="theTable:suggester">

-- Adam



On 8/8/07, sandeep gururaj <sa...@chordiant.com> wrote:
> I encountered this problem too. Here's how I worked around this issue.
>
> a) Create a binding for your ListBox "suggestion" in the bean (Say,
> suggestionBinding).
> b) In the action or actionListener or the like (returnListener in case
> you are using a Dialog) of the "suggester", do the following at the end.
>
> RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
> RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
> g);
> FacesContext.getCurrentInstance().renderResponse();
>
> Hope this helps!
>
> ~Sandeep
>
> -----Original Message-----
> From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it]
> Sent: Wednesday, August 08, 2007 1:00 PM
> To: MyFaces Discussion
> Subject: [Trinidad] PPR from table cells failure
>
> Hi, I wonder how I can trigger PPR from inside a table cell, since it
> appears not working - I guess because of some id mismatch.
> I have something like:
>
> <tr:table ...
>     <tr:column>
>           <tr:commandLink id="suggester" partialSubmit="true"...
>     ...
>     </tr:table>
> <tr:selectOneListbox id="suggestion" partialTriggers="suggester">
>
> then I get a warning from Trinidad as soon as I click on any table link:
>
> Could not find partial trigger suggester from
> CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]
>
> However, if I place the trigger component also outside the table, then
> PPR works properly and there is no warning., even while clicking on any
> link inside the table.
> I guess this issue has something to do with real trigger name, which is
> <container>:<rowIndex>:suggester, but I thought Trinidad should take
> care of matching these ids against a partialTrigger attribute. If not,
> how can I workaround it ?
>
> -- Renzo
>
>

Re: [Trinidad] PPR from table cells failure

Posted by Danny Robinson <da...@gmail.com>.
Sandeep,

It works in exactly the same way for tables with x rows.  I know you would
think it surely can't but it does. Here's a snippet from one of my examples
for removing rows from a table.

Danny

          <tr:table id="incExpTable" value="#{incExpBean.list}"
            rows="10" binding="#{incExpBean.tableComponent}"
            summary="Element information" var="item"
            partialTriggers="addRowButton
incExpTable:removeRowButtonincLink expLink">
            <tr:column headerText="Amount">
              <tr:inputText id="tableAmountField" simple="true"
label="amount"
                value="#{item.amount}" required="true" autoSubmit="true">
                <tr:convertNumber maxFractionDigits="2"
                  minFractionDigits="2" type="number" />
                <tr:validateLongRange minimum="0" />
              </tr:inputText>
              <tr:message for="tableAmountField" />
            </tr:column>

            <tr:column headerText="Remove">
              <tr:commandButton id="removeRowButton"
                actionListener="#{incExpBean.removeRow}"
                icon="/components/images/file.gif" partialSubmit="true">
              </tr:commandButton>
            </tr:column>

          </tr:table>


  public void removeRow(ActionEvent event)
  {
    CoreTable table = getTableComponent();
    int idx = table.getRowIndex();
    if (idx >= 0)
      getList().remove(idx);
  }


On 8/8/07, sandeep gururaj <sa...@chordiant.com> wrote:
>
>
> Hello Danny,
>
> Thanks very much.
>
> I did use this at places where the number of rows of the table is fixed
> and known. In this case, the id for all the commandLinks can be different.
>
> Do we have a similar way for the case when the number of rows is not
> fixed? Let me explain the scenario further.
>
> In the same example as before, if there are more than one suggesters
> (number not known), I need to have command links for all. How do I determine
> the "id" for all of them?
>
> Thanks.
> ~Sandeep
> ________________________________________
> From: Danny Robinson [mailto:dannyjrobinson@gmail.com]
> Sent: Wednesday, August 08, 2007 6:14 PM
> To: MyFaces Discussion
> Subject: Re: [Trinidad] PPR from table cells failure
>
> Sandeep,
>
> That's one way, but a bit overly complex. Here's the easy way:
>
> <tr:table id"aTable" ...
> <tr:column>
>   <tr:commandLink id="suggester" partialSubmit="true"...
> ...
> </tr:table>
> <tr:selectOneListbox id="suggestion" partialTriggers="aTable:suggester">
>
> Regards,
>
> Danny
> On 8/8/07, sandeep gururaj <sa...@chordiant.com> wrote:
> I encountered this problem too. Here's how I worked around this issue.
>
> a) Create a binding for your ListBox "suggestion" in the bean (Say,
> suggestionBinding).
> b) In the action or actionListener or the like (returnListener in case
> you are using a Dialog) of the "suggester", do the following at the end.
>
> RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
> RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
> g);
> FacesContext.getCurrentInstance().renderResponse();
>
> Hope this helps!
>
> ~Sandeep
>
> -----Original Message-----
> From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it ]
> Sent: Wednesday, August 08, 2007 1:00 PM
> To: MyFaces Discussion
> Subject: [Trinidad] PPR from table cells failure
>
> Hi, I wonder how I can trigger PPR from inside a table cell, since it
> appears not working - I guess because of some id mismatch.
> I have something like:
>
> <tr:table ...
> <tr:column>
> <tr:commandLink id="suggester" partialSubmit="true"...
> ...
> </tr:table>
> <tr:selectOneListbox id="suggestion" partialTriggers="suggester">
>
> then I get a warning from Trinidad as soon as I click on any table link:
>
> Could not find partial trigger suggester from
> CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]
>
> However, if I place the trigger component also outside the table, then
> PPR works properly and there is no warning., even while clicking on any
> link inside the table.
> I guess this issue has something to do with real trigger name, which is
> <container>:<rowIndex>:suggester, but I thought Trinidad should take
> care of matching these ids against a partialTrigger attribute. If not,
> how can I workaround it ?
>
> -- Renzo
>
>
>
> --
> Chordiant Software Inc.
> www.chordiant.com
>



-- 
Chordiant Software Inc.
www.chordiant.com

RE: [Trinidad] PPR from table cells failure

Posted by sandeep gururaj <sa...@Chordiant.com>.
Hello Danny,

Thanks very much. 

I did use this at places where the number of rows of the table is fixed and known. In this case, the id for all the commandLinks can be different.

Do we have a similar way for the case when the number of rows is not fixed? Let me explain the scenario further.

In the same example as before, if there are more than one suggesters (number not known), I need to have command links for all. How do I determine the "id" for all of them?

Thanks.
~Sandeep
________________________________________
From: Danny Robinson [mailto:dannyjrobinson@gmail.com] 
Sent: Wednesday, August 08, 2007 6:14 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] PPR from table cells failure

Sandeep,

That's one way, but a bit overly complex.  Here's the easy way:

<tr:table id"aTable" ...
   <tr:column>
         <tr:commandLink id="suggester" partialSubmit="true"... 
   ...
   </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="aTable:suggester">

Regards,

Danny
On 8/8/07, sandeep gururaj <sa...@chordiant.com> wrote:
I encountered this problem too. Here's how I worked around this issue.

a) Create a binding for your ListBox "suggestion" in the bean (Say,
suggestionBinding).
b) In the action or actionListener or the like (returnListener in case 
you are using a Dialog) of the "suggester", do the following at the end.

RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin 
g);
FacesContext.getCurrentInstance().renderResponse();

Hope this helps!

~Sandeep

-----Original Message-----
From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it ]
Sent: Wednesday, August 08, 2007 1:00 PM
To: MyFaces Discussion
Subject: [Trinidad] PPR from table cells failure

Hi, I wonder how I can trigger PPR from inside a table cell, since it
appears not working - I guess because of some id mismatch. 
I have something like:

<tr:table ...
    <tr:column>
          <tr:commandLink id="suggester" partialSubmit="true"...
    ...
    </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="suggester"> 

then I get a warning from Trinidad as soon as I click on any table link:

Could not find partial trigger suggester from
CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]

However, if I place the trigger component also outside the table, then 
PPR works properly and there is no warning., even while clicking on any
link inside the table.
I guess this issue has something to do with real trigger name, which is
<container>:<rowIndex>:suggester, but I thought Trinidad should take 
care of matching these ids against a partialTrigger attribute. If not,
how can I workaround it ?

-- Renzo



-- 
Chordiant Software Inc.
www.chordiant.com 

Re: [Trinidad] PPR from table cells failure

Posted by David Uebelacker <da...@uebelacker.eu>.
Hi,

i just have the same problem in my tables and i don't get it solved :-(.

<tr:table partialTriggers="eventsTable:deleteEventButton" ...
<tr:commandLink
  action="#{editInstrumentBean.deleteEvent}"
  id="deleteEventButton"
  immediate="true"
  onclick="if (!(confirmDeletion())) return false"
  partialSubmit="true">
  <tr:image source="/skins/ict/images/delete.png"/>
  <tr:setActionListener from="#{row.entity}"
to="#{editInstrumentBean.eventToDelete}"/>
</tr:commandLink>

Executing the action, always the last row gets removed but not the one i
wanted to delete. If I set immediate=false it works, but i don't want to
validate the complete form, when i delete a row in the table.

thanks

David

>         Thanks Danny, just tried and it works fine as well. Exactly as
> described.
>  During my first posting,  I forgot that - since a table is a naming
> container - it couldn't work like I tried first. The contained prefix had
> to be specified is different.
>
>  -- Renzo
>
>  Danny Robinson wrote:     Sandeep,
>
>  That's one way, but a bit overly complex.  Here's the easy way:
>
>


-- 
David Uebelacker
mailto:david@uebelacker.eu
http://david.uebelacker.eu/


Re: [Trinidad] PPR from table cells failure

Posted by Danny Robinson <da...@gmail.com>.
Sandeep,

That's one way, but a bit overly complex.  Here's the easy way:

<tr:table id"aTable" ...
   <tr:column>
         <tr:commandLink id="suggester" partialSubmit="true"...
   ...
   </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="aTable:suggester">

Regards,

Danny

On 8/8/07, sandeep gururaj <sa...@chordiant.com> wrote:
>
> I encountered this problem too. Here's how I worked around this issue.
>
> a) Create a binding for your ListBox "suggestion" in the bean (Say,
> suggestionBinding).
> b) In the action or actionListener or the like (returnListener in case
> you are using a Dialog) of the "suggester", do the following at the end.
>
> RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
> RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
> g);
> FacesContext.getCurrentInstance().renderResponse();
>
> Hope this helps!
>
> ~Sandeep
>
> -----Original Message-----
> From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it]
> Sent: Wednesday, August 08, 2007 1:00 PM
> To: MyFaces Discussion
> Subject: [Trinidad] PPR from table cells failure
>
> Hi, I wonder how I can trigger PPR from inside a table cell, since it
> appears not working - I guess because of some id mismatch.
> I have something like:
>
> <tr:table ...
>     <tr:column>
>           <tr:commandLink id="suggester" partialSubmit="true"...
>     ...
>     </tr:table>
> <tr:selectOneListbox id="suggestion" partialTriggers="suggester">
>
> then I get a warning from Trinidad as soon as I click on any table link:
>
> Could not find partial trigger suggester from
> CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]
>
> However, if I place the trigger component also outside the table, then
> PPR works properly and there is no warning., even while clicking on any
> link inside the table.
> I guess this issue has something to do with real trigger name, which is
> <container>:<rowIndex>:suggester, but I thought Trinidad should take
> care of matching these ids against a partialTrigger attribute. If not,
> how can I workaround it ?
>
> -- Renzo
>
>


-- 
Chordiant Software Inc.
www.chordiant.com

Re: [Trinidad] PPR from table cells failure

Posted by Renzo Tomaselli <re...@tecnotp.it>.
Well, since things go on, I reply to myself :-)
A trivial way for postprocessing PPR is achieved by enclosing the target 
element in a container, using this as the real PPR target, such as:

            <tr:panelHorizontalLayout partialTriggers="f:suggester">
                <tr:selectOneListbox id="suggestion" ...
                ...
                <script type="text/javascript">
                    doSomeInitStuff();
                </script>
            </tr:panelHorizontalLayout>   

Then doSomeInitStuff() is executed after each PPR. This solution works 
well for FF but not for IE if there is need to access any element not 
included in the PPR target.
This is due to the _pprIFrame which contains only the returned target, 
and on IE the js fragment executes in the context of the iframe dom.
Is there any way to access the rest of current document from there ?

-- Renzo

Renzo Tomaselli wrote:
> Thanks Sandeep, this works fine indeed.
> I have one more question, though: my listbox acts as a suggestion list 
> which is made visible and attached to each row input field upon any 
> suggester onclick event.
> Thus the sequence is: make it visible, move it below the related input 
> field, then trigger PPR.
> Unfortunately I noticed that after PPR the list is re-rendered at its 
> original position/size, while contents are ok. Thus the list appears 
> at its row position for a second, then it moves to the (wrong) 
> original position.
> Is there any js way to post-process a PPR, so that I can definitely 
> move that list to its correct position *after* the PPR response ?
>
> -- Renzo
>
> sandeep gururaj wrote:
>> I encountered this problem too. Here's how I worked around this issue.
>>
>> a) Create a binding for your ListBox "suggestion" in the bean (Say,
>> suggestionBinding).
>> b) In the action or actionListener or the like (returnListener in case
>> you are using a Dialog) of the "suggester", do the following at the end.
>>
>> RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
>> RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
>> g);
>> FacesContext.getCurrentInstance().renderResponse();
>>
>> Hope this helps!
>>
>> ~Sandeep
>>  
>> -----Original Message-----
>> From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it] Sent: 
>> Wednesday, August 08, 2007 1:00 PM
>> To: MyFaces Discussion
>> Subject: [Trinidad] PPR from table cells failure
>>
>> Hi, I wonder how I can trigger PPR from inside a table cell, since it 
>> appears not working - I guess because of some id mismatch.
>> I have something like:
>>
>> <tr:table ...
>>     <tr:column>
>>           <tr:commandLink id="suggester" partialSubmit="true"...
>>     ...
>>     </tr:table>
>> <tr:selectOneListbox id="suggestion" partialTriggers="suggester">
>>
>> then I get a warning from Trinidad as soon as I click on any table link:
>>
>> Could not find partial trigger suggester from 
>> CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]
>>
>> However, if I place the trigger component also outside the table, 
>> then PPR works properly and there is no warning., even while clicking 
>> on any link inside the table.
>> I guess this issue has something to do with real trigger name, which 
>> is <container>:<rowIndex>:suggester, but I thought Trinidad should 
>> take care of matching these ids against a partialTrigger attribute. 
>> If not, how can I workaround it ?
>>
>> -- Renzo
>>
>>
>>
>>   
>
>

Re: [Trinidad] PPR from table cells failure

Posted by Renzo Tomaselli <re...@tecnotp.it>.
Thanks Sandeep, this works fine indeed.
I have one more question, though: my listbox acts as a suggestion list 
which is made visible and attached to each row input field upon any 
suggester onclick event.
Thus the sequence is: make it visible, move it below the related input 
field, then trigger PPR.
Unfortunately I noticed that after PPR the list is re-rendered at its 
original position/size, while contents are ok. Thus the list appears at 
its row position for a second, then it moves to the (wrong) original 
position.
Is there any js way to post-process a PPR, so that I can definitely move 
that list to its correct position *after* the PPR response ?

-- Renzo

sandeep gururaj wrote:
> I encountered this problem too. Here's how I worked around this issue.
>
> a) Create a binding for your ListBox "suggestion" in the bean (Say,
> suggestionBinding).
> b) In the action or actionListener or the like (returnListener in case
> you are using a Dialog) of the "suggester", do the following at the end.
>
> RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
> RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
> g);
> FacesContext.getCurrentInstance().renderResponse();
>
> Hope this helps!
>
> ~Sandeep
>  
> -----Original Message-----
> From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it] 
> Sent: Wednesday, August 08, 2007 1:00 PM
> To: MyFaces Discussion
> Subject: [Trinidad] PPR from table cells failure
>
> Hi, I wonder how I can trigger PPR from inside a table cell, since it 
> appears not working - I guess because of some id mismatch.
> I have something like:
>
> <tr:table ...
>     <tr:column>
>           <tr:commandLink id="suggester" partialSubmit="true"...
>     ...
>     </tr:table>
> <tr:selectOneListbox id="suggestion" partialTriggers="suggester">
>
> then I get a warning from Trinidad as soon as I click on any table link:
>
> Could not find partial trigger suggester from 
> CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]
>
> However, if I place the trigger component also outside the table, then 
> PPR works properly and there is no warning., even while clicking on any 
> link inside the table.
> I guess this issue has something to do with real trigger name, which is 
> <container>:<rowIndex>:suggester, but I thought Trinidad should take 
> care of matching these ids against a partialTrigger attribute. If not, 
> how can I workaround it ?
>
> -- Renzo
>
>
>
>   

RE: [Trinidad] PPR from table cells failure

Posted by sandeep gururaj <sa...@Chordiant.com>.
I encountered this problem too. Here's how I worked around this issue.

a) Create a binding for your ListBox "suggestion" in the bean (Say,
suggestionBinding).
b) In the action or actionListener or the like (returnListener in case
you are using a Dialog) of the "suggester", do the following at the end.

RequestContext.getCurrentInstance().addPartialTarget(suggestionBinding);
RequestContext.getCurrentInstance().partialUpdateNotify(suggestionBindin
g);
FacesContext.getCurrentInstance().renderResponse();

Hope this helps!

~Sandeep
 
-----Original Message-----
From: Renzo Tomaselli [mailto:renzo.tomaselli@tecnotp.it] 
Sent: Wednesday, August 08, 2007 1:00 PM
To: MyFaces Discussion
Subject: [Trinidad] PPR from table cells failure

Hi, I wonder how I can trigger PPR from inside a table cell, since it 
appears not working - I guess because of some id mismatch.
I have something like:

<tr:table ...
    <tr:column>
          <tr:commandLink id="suggester" partialSubmit="true"...
    ...
    </tr:table>
<tr:selectOneListbox id="suggestion" partialTriggers="suggester">

then I get a warning from Trinidad as soon as I click on any table link:

Could not find partial trigger suggester from 
CoreSelectOneListbox[UIXEditableFacesBeanImpl, id=suggestion]

However, if I place the trigger component also outside the table, then 
PPR works properly and there is no warning., even while clicking on any 
link inside the table.
I guess this issue has something to do with real trigger name, which is 
<container>:<rowIndex>:suggester, but I thought Trinidad should take 
care of matching these ids against a partialTrigger attribute. If not, 
how can I workaround it ?

-- Renzo