volvox
volvox

Reputation: 3060

returning a4j:included content using bean-generated rich:dropDownMenu

I may be missing a couple of points, but I've hacked together a jsf/richfaces app and want to be able to do the simplest ajax-based nav:

main page contains ref to my backing bean's menu

            <h:form>
                <rich:dropDownMenu binding="#{PrismBacking.nodeMenu}" />
            </h:form>

this refers to the code for the backing bean methods

this is my main page ajax panel

    <rich:panel id="content">
        <a4j:include viewId="#{PrismBacking.viewId}" />
    </rich:panel>

i can't work out how to get the backing bean to use the selected item from the rich:dropDownMenu to update that which is returned by getViewId.

i guess: 1) i need to ensure the menu items in the getNodeMenu method have the right payload so setViewId is called with the correct String and my rich:panel id="content" is reRendered.

any pointers as to how to do this would be greatly appreciated.
mark

Upvotes: 2

Views: 1075

Answers (2)

Bozho
Bozho

Reputation: 597164

Using binding should be avoided if possible. Take a look at the RichFaces demo - there are source codes for each example, and see how it is achieved.

(This doesn't answer your question, and for better :) )

Upvotes: 0

kpolice
kpolice

Reputation: 591

You are not setting the reRender attribute anywhere in your code (in the menu items) so the panel is not going to be updated after you select an item from the dropdown.

You also have to set the ajaxSubmit attribute en each menuItem to true in order to execute an ajax request. Also check that your listener is executed.

Take a look at the example http://livedemo.exadel.com/richfaces-demo/richfaces/dropDownMenu.jsf?c=dropDownMenu . You can download the code if you want from the richfaces site.

Upvotes: 1

Related Questions