Grails: How to create a filter like in MS Excel?

I want to sort the items in my list and be able to filter them the same way MS Excel does.

Thus, he should be able to save the filtered elements in a table and apply a filter in these results. You can also sort them without updating the entire table.

Any help is much appreciated!

+3
source share
1 answer

You can do this using the criteria in your controller’s action list.

def result

if ( params?.filter && params?.filterVal) {
    result = Book.createCriteria().list(max: params?.max, offset: params?.offset) {
         eq(params?.filter,params?.filterVal)
    }
} else {
    // normal list retrieval code
}

where params?.filteris the filtering property, and params?.filterValis the value

0
source

Source: https://habr.com/ru/post/1770166/


All Articles