尊重过滤Grails

时间:2016-11-04 17:52:21

标签: grails gsp

我有一个表,和三个不同的(Open,Close,Pending),当用户按客户端过滤时,查看相应的值。

但是当用户从示例更改时:打开到关闭表丢失了过滤器,有没有办法尊重gsp视图之间的过滤器?

1 个答案:

答案 0 :(得分:0)

确保在g:select上设置值=(参见下面的代码),页面应该记住设置。

    <div class="form-group ${hasErrors(bean: searchCommand, field: 'testTypeId', 'has-error')}">
        <label for="testType">
            Test Type
        </label>
        <g:select id="testType" name="testTypeId" from="${TestType.findAllByActive(true).sort({it.sortOrder})}" optionKey="id"
                  value="${searchCommand?.testTypeId}" noSelection="['':'-Choose One-']" class="form-control"/>
    </div>