-
I’m sending HashMap from controller to view:
def list2 = [id:params?.id, title:params?.title, domain:params?.domain, orderOfSubpage:params?.orderOfSubpage] render(view: "list", model: [subpageInstanceList: list, subpageInstanceTotal: list.getTotalCount(), searchParams:list2]) -
I’m sending back this HashMap to the controller when user clicks on table header:
<g:sortableColumn property="id" title="Id" class="td-id-class subpage-td" params="['searchParams':searchParams]"/> -
I’m checking value in debugger where flag is set here:
def map = paramsThe value is:
searchParams={id=, title=, domain=, orderOfSubpage=} -
I’m trying to get values from this ‘map’ which is already String:
def map2 = params?.searchParams def id = map2?.id //here is an Exception (checked in debugger) -
Exception I’m getting back is:
Class groovy.lang.MissingPropertyException Message No such property: id for class: java.lang.String
When I’m doing the same thing with ArrayList there is no problem, everything works fine and List is always List. Why Map transforms/casts to the String?
Question: Why object sent back to the controller is String or at least acts like a String?
From http://grails.org/doc/latest/ref/Tags/sortableColumn.html:
You have:
<g:sortableColumn ... params="['searchParams':searchParams]"/>. But searchParams is not a proper request parameter because it is itself a map.Add all your values like id, title, domain, and orderOfSubpage explicitly like:
or even: