我有两个域类:-
class Product {
ProductType productType
int openingQuantity
int unitQuantity
Date dateCreated
Date lastUpdated
boolean active
static constraints = {
productType(blank:false,nullable:false)
openingQuantity(blank:false, nullable:false)
unitQuantity(blank:false, nullable:false)
active(nullable:false)
dateCreated()
lastUpdated()
}
}
和
class ProductType {
String name
Date dateCreated
Date lastUpdated
static constraints = {
name(nullable:false, blank:false,maxSize:50,validator: {
return !ProductType.findByNameIlike(it)
})
dateCreated()
lastUpdated()
}
}
当我在产品的 create.gsp 中时。它在下拉菜单中将 productType 显示为 id。但我的要求是在下拉列表中显示 ProductType 名称。谁能帮忙。