I am trying to pass params.sort to my controller.
if (params.sort && params.order == "asc") {
pricesInPriceList = row.prices.sort{it.material."${params.sort}"}
}
if (params.sort && params.order == "desc"){
pricesInPriceList = row.prices.sort{it.material."${params.sort}"}.reverse()
}
[priceListInstance: row, pricesInPriceList: pricesInPriceList]
It works fine with following gsp:
<tr>
<g:sortableColumn property="sku" title="SKU" />
<g:sortableColumn property="description" title="Description" />
</tr>
Now if I change my gsp to following:
<tr>
<g:sortableColumn property="material.sku" title="SKU" />
<g:sortableColumn property="material.description" title="Description" />
</tr>
and my controller part to:
if (params.sort && params.order == "asc") {
pricesInPriceList = row.prices.sort{it."${params.sort}"}
}
if (params.sort && params.order == "desc"){
pricesInPriceList = row.prices.sort{it."${params.sort}"}.reverse()
}
Why this is happening? now my params.sort has a value material.sku for example however if I want to evaluate it."${params.sort}"
it does not work. But if I will change my params.sort to sku and then change my controller to it.material."${params.sort}"
everything is working. Where I am making mistake?
Thank you.