How can I development a chainSelect widget but with groups and users?

I want to development a widget where I can select a group on a selectListBox and using ajax to update another selectListBox with group's users selected.

I was reviewing http://community.nuxeo.com/api/nuxeo/5.6/tlddoc/ but those widgets only works with vocabularies.

I try to use and custom widget template to select groups from a vocabulary and another widget user suggestion:

<c:if test="true" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
    xmlns:nxu="http://nuxeo.org/nxweb/util"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:nxdir="http://nuxeo.org/nxdirectory"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:nxp="http://nuxeo.org/nxweb/pdf">

    <c:if test="#{widget.mode == 'edit'}">

        <c:set var="directory"
            value="#{nxu:test(!empty widgetProperty_directory, widgetProperty_directory, 'CoorAsig')}" />
        <c:set var="required"
            value="#{nxu:test(!empty widgetProperty_required, widgetProperty_required, false)}" />


        <a4j:region renderRegionOnly="true" id="#{widget.id}_region">
            <nxdir:selectOneListbox id="#{widget.id}" value="#{field_0}"
                directoryName="#{directory}" displayIdAndLabel="true"
                required="#{required}"
                valueChangeListener="#{userSuggestionActions.selectUserGroup}">
                <a4j:support event="onchange" ignoreDupResponses="true" reRender="selectUser"
                    bypassUpdates="true" />
            </nxdir:selectOneListbox>

        </a4j:region>


        <a4j:outputPanel ajaxRendered="true">   
            <h:message for="#{widget.id}" styleClass="errorMessage" />
        </a4j:outputPanel>
    </c:if>
</c:if>

and I overwrote userSuggestionActions's getSuggestions method seam component, in this component, I created selectUserGroup variable . When I select a group on my selectListBox, this variable is updated and when I search a user in my user suggestion widget, this is filtered by group selected.

The problem is when I select another group, I do not know how to delete the user selected in user suggestion widget

0 votes

0 answers

1022 views

ANSWER