You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by wjones14 <bi...@snet.net> on 2008/04/10 17:21:08 UTC

Component rendering order issue?

We have a screen with a datatable, a Command Button and a SelectOneMenu
drop-down list.  The user chooses an item from the drop-down, presses the
button to add this item to the datatable, and when the page re-displays the
datatable should have one more item, and the drop-down list should have one
less item.

However, what is happening is that the drop-down list is not refreshing on
the first button press, so the previously selected item is still there,
while the datatable is refreshing, showing the added item.

The command button action is datatable.addItem.

So I ran this in a debugger with breakpoints in the addItem method, and in
the drop-down list load method.  When the command button is pressed, instead
of going right into the addItem method, the execution first goes to the
drop-down list load method - so the same list is displayed again.  Then the
execution goes into the datatable bean's addItem method, and the datatable
is properly refreshed.

Is there a way to get the addItem method to be invoked before the
SelectOneMenu's load method?


Thanks,

Bill
-- 
View this message in context: http://www.nabble.com/Component-rendering-order-issue--tp16609078p16609078.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Component rendering order issue?

Posted by wjones14 <bi...@snet.net>.
Sure, here's the jsp snippet containing the section I'm talking about:

**********************************
<t:saveState value="#{user_comp}"/>

<h:dataTable id="userRolesTable"
             value="#{user_comp.userRoles}"
             var="role"
             first="#{user_comp.userRoles.pageHandler.firstRowIndex}"
             rows="#{user_comp.userRoles.pageHandler.displayCount}"
             styleClass="dataTable"
             columnClasses="center, left, left"
             rowClasses="odd, even">

    <h:column>
            <h:outputText value="#{role.roleId}" styleClass="label"/>
    </h:column>

</h:dataTable>

<h:panelGrid columns="2" columnClasses="right, left">
    <f:verbatim>Add a Role:</f:verbatim>

    <h:selectOneMenu id="selectNewRole"
                     value="#{user_comp.userRoles.new.roleId}"
styleClass="selectSimple1">
        <f:selectItem itemLabel="- Select -" itemValue=""/>
        <f:selectItems value="#{roleSelectList.selectItems}"/>
    </h:selectOneMenu>
</h:panelGrid>

<h:commandButton styleClass="buttonSimple" value="Add Role to User"
                 action="#{user_comp.userRoles.addNew}"/>
**********************************

We are not using PPR.  We are using MyFaces 1.1.4. and JDK 1.5_04.


Thanks,

Bill



Richard Yee-3 wrote:
> 
> Can you send your jspx page? Are you using PPR at all?
> 
> -Richard
> 
> 

-- 
View this message in context: http://www.nabble.com/Component-rendering-order-issue--tp16609078p16616240.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Component rendering order issue?

Posted by Richard Yee <ri...@gmail.com>.
Can you send your jspx page? Are you using PPR at all?

-Richard




On 4/10/08, wjones14 <bi...@snet.net> wrote:
>
>
> We have a screen with a datatable, a Command Button and a SelectOneMenu
> drop-down list.  The user chooses an item from the drop-down, presses the
> button to add this item to the datatable, and when the page re-displays
> the
> datatable should have one more item, and the drop-down list should have
> one
> less item.
>
> However, what is happening is that the drop-down list is not refreshing on
> the first button press, so the previously selected item is still there,
> while the datatable is refreshing, showing the added item.
>
> The command button action is datatable.addItem.
>
> So I ran this in a debugger with breakpoints in the addItem method, and in
> the drop-down list load method.  When the command button is pressed,
> instead
> of going right into the addItem method, the execution first goes to the
> drop-down list load method - so the same list is displayed again.  Then
> the
> execution goes into the datatable bean's addItem method, and the datatable
> is properly refreshed.
>
> Is there a way to get the addItem method to be invoked before the
> SelectOneMenu's load method?
>
>
> Thanks,
>
> Bill
> --
> View this message in context:
> http://www.nabble.com/Component-rendering-order-issue--tp16609078p16609078.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>