cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Choice lists

dcrossma
Champ in-the-making
Champ in-the-making
Hi I was wondering if anyone had created a dynamic choice list for entering metadata???

I would like to have one list and then based on what value is selected I would like to populate a second list??? This is something I have done before using javascript in web apps but I am not sure how to proceed with alfresco

any help would be appreciated

Cheers Dave
10 REPLIES 10

gavinc
Champ in-the-making
Champ in-the-making
The JSF selectOne component (and many others) has the valueChangedListener attribute available. If you bind this to a method on your bean it will get called back when the user makes a change.

The code in the managed bean called can create the items for the other list so when the page refreshes those values are shown.

For example:

<h:selectOneMenu … valueChangeListener="#{YourBean.somethingChanged}">
…..
</h:selectOneMenu>

<h:selectOneMenu …>
   <f:selectItems value="#{YourBean.dynamicValues}" />
</h:selectOneMenu>

dcrossma
Champ in-the-making
Champ in-the-making
Thanks gavin I will give that a go

dcrossma
Champ in-the-making
Champ in-the-making
The JSF selectOne component (and many others) has the valueChangedListener attribute available. If you bind this to a method on your bean it will get called back when the user makes a change.

The code in the managed bean called can create the items for the other list so when the page refreshes those values are shown.

For example:

<h:selectOneMenu … valueChangeListener="#{YourBean.somethingChanged}">
…..
</h:selectOneMenu>

<h:selectOneMenu …>
   <f:selectItems value="#{YourBean.dynamicValues}" />
</h:selectOneMenu>

I have created my custom metadata by following the tutorial Displaying Custom Metatdata http://wiki.alfresco.com/wiki/Displaying_Custom_Metadata . This works great.

What Im not sure of is how do I bind a bean to my config evaluator????Preferably I would have thought you would want the binding to be on the property sheet????

Gavins example above seems to almost be creating a custom .jsp page ? I would rather use the web-client-config-custom.xml file.

Also if anyone could provide me with the path for .jsp file that is used to display the editable properties with the metadata that would be appreciated.

I have never used JSF so this is new to me thanks for your patience

Dave

gavinc
Champ in-the-making
Champ in-the-making
Yes, my example was presuming a custom page, the property sheet does not have built in support for what you want to do.

The "editContentProperties" dialog deals with the saving of properties, the JSP for this is "/jsp/content/edit-content-properties.jsp" and the managed bean for the dialog is "EditContentPropertiesDialog".

If you need to do something custom then you'll need to override the editContentProperties dialog definition with your own bean. However, if you're just editing properties from your model you shouldn't need to use a custom bean the built in one should suffice.

renga
Champ in-the-making
Champ in-the-making
Is it possible to read the custom properties from a database table. And also is it possible to provide a maintenace screens to manage these custom tables from administrator  console.

Thanks in advance.

gavinc
Champ in-the-making
Champ in-the-making
Yes, it is possible to read the properties directly from the database, they will be in the alf_node_properties.

It is on the roadmap to provide an interface for administering custom models but there isn't a specific time set for this feature.

renga
Champ in-the-making
Champ in-the-making
Thanks Gavin!

BTW, my question was is it possible to provide a combo box list in the content creation wizard/user creation wizard which shows the data from the lookup table in the database.

Thanks in advance

gavinc
Champ in-the-making
Champ in-the-making
Not out of the box, but yes, with some custom code it's certainly possible to do this. You'll need to follow the same pattern used in the existing wizards to get the values i.e. a method that returns a List of SelectItem objects.

Have a look at the getObjectTypes() method in BaseContentWizard.java.

nahanni
Champ in-the-making
Champ in-the-making
Hi,

gavinc said " the property sheet does not have built in support for what you want to do", but if we developp a new componenet generator based on TextFieldGenerator, it should be possible to associate a valueChangedListener programatically ?

Something like :


component = context.getApplication().createComponent(UISelectOne.COMPONENT_TYPE);
           
…     
     
component.setValueChangeListener(…);

But, UIComponent don't have setValueChangeListener method.


Any suggestion ?

Thank you.

Dom