我正在使用grails easygrid插件。
ownerGrid {
dataSourceType 'gorm'
domainClass Owner
gridImpl 'dataTables'
fixedColumns true
columns {
room
{ label "owner.room.label"
type 'text'
value {owner->owner.room.toString()}
filterClosure { filter ->
room {
ilike(...., "%${filter.paramValue}%")
}
}
}
我对如何在grails中建立标准一无所知,但我想比较room类的toString()值。
我该如何实现?
谢谢
最佳答案
我假设“Room”域对象具有某种name属性(将在toString方法中使用)。
或者,如果更复杂,则可能会从2列或更多列中生成toString。在这种情况下,您可以使用:Gorm derived properties。我们将此派生属性称为“derivedName”。这是网格的样子:
ownerGrid {
dataSourceType 'gorm'
domainClass Owner
gridImpl 'dataTables'
fixedColumns true
columns {
room {
label "owner.room.label"
type 'text'
property owner.room.derivedName
filterClosure { filter ->
room {
ilike('derivedName', "%${filter.paramValue}%")
}
}
}
}
}
关于grails - Grails easygrid插件通过toString()进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21858001/