gpt4 book ai didi

grails - 在 g :select tag in grails 中使用默认值

转载 作者:行者123 更新时间:2023-12-02 06:06:15 25 4
gpt4 key购买 nike

我正在使用这样的 g:select 标签

<g:select id="ua_selectedResource" style="width:100px;font-size: 9px"  from='${resourcesList}' value="" optionKey="id" optionValue="resourceName"  noSelection="['null':'Select a Resource']">
</g:select>

resourceList 是一个资源对象列表(带有字段 id、resourcename...等),我希望默认选择的值为具有 id '1' 的资源。如何在值属性中设置该条件?

最佳答案

您应该能够将 g:select 的值设置为您要选择的 id。

<g:select id="ua_selectedResource" style="width:100px;font-size: 9px"  
from='${resourcesList}' value="1" optionKey="id" optionValue="resourceName"
noSelection="['null':'Select a Resource']" />

关于grails - 在 g :select tag in grails 中使用默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9355441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com