提交 1182fe44 编写于 作者: O Olivier Lamy

Merge pull request #771 from imod/dropdownDescriptorSelector-defaulting-to-instance

[FIXED JENKINS-17858] allow <f:dropdownDescriptorSelector> to be defaulting to an instance
......@@ -39,7 +39,8 @@ THE SOFTWARE.
If unspecified, inferred from the type of the field.
</st:attribute>
<st:attribute name="default">
If specified, this will be chosen as the default value in case the current selection is null.
If specified, this will be chosen as the default value in case the current selection is null. The default can be an specific instance or a descriptor e.g.
${descriptor.defaultSettingsProvider} or ${descriptor.defaultSettingsProvider.descriptor}. In the later case, the from input fields will be empty.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
......@@ -49,6 +50,7 @@ THE SOFTWARE.
<d:invokeBody />
<j:set var="current" value="${instance[attrs.field]}"/>
<j:set var="current" value="${current!=null ? current : (default.descriptor!=null ? default : null)}"/>
<j:forEach var="descriptor" items="${attrs.descriptors}" varStatus="loop">
<f:dropdownListBlock value="${loop.index}" title="${descriptor.displayName}"
selected="${current.descriptor==descriptor || (current==null and descriptor==attrs.default)}" staplerClass="${descriptor.clazz.name}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册