views:

324

answers:

2

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

+1  A: 

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.

kpolice
A: 

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 :) )

Bozho
Bozho, your link pointed at an ordered pick list. I'm looking for a dynamically built dropdownmenu. I am up for not using binding, but i can't find a comprehensive example there of how to build a dynamically built rich:dropdownmenu without using bindings. the richfaces demo for that tag only deals with fixed menuitems.
Mark Lewis
my link was to a page in the richfaces demo - look through all a4j: tags there
Bozho
@Bozho, your link appears to follow to the RF demo for an ordering list. Was this deliberate? As mentioned I'm after a dynamic drop down menu.
Mark Lewis