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
[email protected]
http://lists.xwiki.org/mailman/listinfo/users