Marius,
Thanks for your reply.
I placed the userReference.name in the extra params like so:
'extraParams': '&assignee=$xcontext.userReference.name'
Printing to screen $xcontext.userReference.name does show 'test' as the value,
unfortunately my livetable is still showing blank results. However when I replace the
$xcontext.userReference.name with the hard-coded value 'test' like so:
'extraParams': '&assignee=test'
the livetable shows the correct results. This seems like very strange behaviour to me and
I cannot seem to get this filter working. Even though I set the "List of Users"
value to the currently logged in user with $context.user, I cannot seem to filter the
table with any of the $context variables.
Any other ideas?
Kelly
----- Original Message -----
From: "Marius Dumitru Florea" <mariusdumitru.florea(a)xwiki.com>
To: "XWiki Users" <users(a)xwiki.org>
Sent: Thursday, January 23, 2014 2:26:44 AM
Subject: Re: [xwiki-users] LivetableResults filter query
Try $xcontext.userReference.name
Hope this helps,
Marius
On Thu, Jan 23, 2014 at 1:01 AM, Kelly Steinke <ksteinke(a)steel-craft.ca> wrote:
I have a Subwiki where I have created a Live Table
called Active Tasks and I have been trying to filter the results based on two properties
status and assignee. As defined in the TaskManagerClass, status is a database list and
assignee is a list of users (local subwiki users). I have defined the live table like so:
#set ($columnsProperties = {
'number': {"type":"number","size":10},
'doc.title':
{"type":"text","size":20,"link":"view"},
'project': {"type":"list","size":10},
'status': {"type":"list","size":10},
'severity': {"type":"list","size":10},
'reporter':
{"type":"text","size":10,"html":true},
'assignee':
{"type":"text","size":10,"html":true},
'duedate': {"type":"text","size":10},
'_actions':
{"sortable":false,"filterable":false,"html":true,"actions":["edit","delete"]}
})
#set ($options = {
'className': 'TaskManager.TaskManagerClass',
'resultPage': 'TaskManagerCode.MyActiveTasksLiveTableResults',
'translationPrefix': 'taskmanager.livetable.',
'tagCloud': true,
'rowCount': 15,
'maxPages': 10,
'selectedColumn': 'number',
'defaultOrder': 'asc'
})
#set ($columns = ['number', 'doc.title', 'project',
'status', 'severity', 'reporter', 'assignee',
'duedate', '_actions'])
#livetable('myActiveTasks' $columns $columnsProperties $options)
In the resultPage I have the following code:
{{include document="XWiki.LiveTableResultsMacros" /}}
{{velocity wiki="false"}}
#gridresultwithfilter("$!request.classname"
$request.collist.split(",")", StringProperty as statusprop ", "
and obj.id=statusprop.id.id and statusprop.id.name='status' and statusprop.value
not in ('Done')" )
{{/velocity}}
This successfully displays the live table and filters it showing all tasks that have a
status other than "Done". I cannot however successfully get the results to also
filter based on the currently logged in user. In the TaskManagerClass sheet I have set the
assignee property automatically using $context.user when a new entry is made. I have tried
to filter the table at the definition using the extraparams option like so:
' extraParams' : '&assignee=$context.User ',
however when this is added the table does not display any entries. Upon further
investigation I found that when I display what is in the $context.user, it shows as "
XWiki.test " (test being the name of the user I created for testing). The strange
thing is that when I change the extraParams option to be ' extraParams' :
'&assignee=test ' then it works. This means that when I set the default
property in the List of Users with the same function ($context.user), that it set it as
test as opposed to XWiki.test. I also tried using $context.localUser in the extraParams
however that also displays as XWiki.test.
Does this have to do with how the "List of Users" control on the class form is
storing the value from $context.user? How can I filter this live table on the currently
logged in user. I have tried to add another object to my where clause in the
gridreslutwithfilter() call, however I was unsuccessful. If anyone can help me out with
that query or with using the extraParams I would greatly appreciate it.
Regards,
Kelly
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org