我正在使用 grails 1.3.7。
我有以下域:
class Category {
String name;
String categoryKey;
Date dateCreated
Date lastUpdated
static constraints = {
name(blank: false, nullable: false, maxSize:30)
categoryKey(blank: false, nullable: false, maxSize:30)
}
String toString()
{
return name
}
}
我在 gsp 中显示的类别列表如下:
<g:select class="fields" valueMessagePrefix="shared.category.label" name='categoryKey'
value="${dealInstance?.category?.categoryKey}"
noSelection="${['': message(code: 'layouts.main.filter.select', default: '(Please select one)')]}"
from='${categoryList.list()}' optionValue="name"
optionKey="categoryKey"></g:select>
我需要显示删除其中一项的列表(其中 categoryKey 属性等于 OTHER)。
def Category categoryList = Category
//categoryList.categoryKey.remove("OTHER") How to remove here maybe?
return [dealInstance: dealDetails, categoryList: categoryList ]
如何在我的控制器中删除它并将新列表(减去 OTHER)传递给 gsp?
谢谢