If I understand the question correctly, the solution is to insert your
own FROM and WHERE info in the search query, as follows:
...
#gridresultwithfilter( $request.collist.split(,) , StringProperty
examplename and examplename.id.id=obj.id and
examplename.name='examplename' and
It seems what I need,
though I couldn't find working templates for back-end macros.
From pages
http://dev.xwiki.org/xwiki/bin/view/Drafts/XWikiGridComponentTutorial
http://platform.xwiki.org/xwiki/bin/view/DevGuide/LiveTable
I got GridExtensionResultMacros and LiveTableResultsMacros, though