Hi noble Jenkins developers!

It's quite easy to update one simple select (<f:select />) when another is 
changed (see DynamicDropDownListBox from Jenkins UI Samples plugin). But 
what about case when there are two <f:dropdownList/> elements?

I have used DropdownList from UI Samples as a sample to create these:

    <f:block>
        <table>
            <j:set var="currentArtifactDefinition" 
value="${instance.artifacts}"/>
            <f:dropdownList name="artifacts" title="Artifact">
                <j:forEach var="desc" 
items="${descriptor.artifactDescriptors}" varStatus="loop">
                    <j:set var="artifactDescription" 
value="${desc.class.name==currentArtifactDefinition.artifactsClassName?currentArtifactDefinition:null}"/>
                    <f:dropdownListBlock title="${desc.displayName}" 
value="${loop.index}" selected="${artifactDescription!=null}" 
staplerClass="${desc.entityClass.name}">
                        <st:include page="${desc.configPage}" 
from="${desc}"/>
                    </f:dropdownListBlock>
                </j:forEach>
            </f:dropdownList>
        </table>
    </f:block>

    <f:block>
        <table>
            <j:set var="currentScheduleDefinition" 
value="${instance.schedule}"/>
            <f:dropdownList name="schedule" title="Schedule">
                <j:forEach var="desc" 
items="${descriptor.scheduleDescriptors}" varStatus="loop">
                    <j:set var="scheduleDescription" 
value="${desc.class.name==currentScheduleDefinition.scheduleClassName?currentScheduleDefinition:null}"/>
                    <f:dropdownListBlock title="${desc.displayName}" 
value="${loop.index}" selected="${scheduleDescription!=null}" 
staplerClass="${desc.entityClass.name}">
                        <st:include page="${desc.configPage}" 
from="${desc}"/>
                    </f:dropdownListBlock>
                </j:forEach>
            </f:dropdownList>
        </table>
    </f:block>

There are two methods in Descriptor of the build step that has this 
config.jelly, they provide the data for both dropdowns:

    public DescriptorExtensionList<MyBuildStep.ScheduleDefinition, 
Descriptor<MyBuildStep.ScheduleDefinition>> getScheduleDescriptors() {
        return 
Jenkins.getInstance().getDescriptorList(MyBuildStep.ScheduleDefinition.class);
    }

    public DescriptorExtensionList<MyBuildStep.ArtifactDefinition, 
Descriptor<MyBuildStep.ArtifactDefinition>> getArtifactDescriptors() {
        return 
Jenkins.getInstance().getDescriptorList(MyBuildStep.ArtifactDefinition.class);
    }

But how can I handle the change event in the first one to customize the 
selection in the second one?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/3744b377-beb9-4614-b6ec-8ac791b5e0a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to