Search code examples
restdatagriddojoxpagesdojox.grid.datagrid

How to configure an xe:viewFileItemService on an XPage to filter the data in a categorized view?


I have a DocsByUsername categorized view, sorted and categorized by the username. For the authenticated user I only want to display their documents in a Dojo Data Grid. The grid needs to support in-grid editing so I need to use an xe:viewFileItemService read/write service as the data source for the grid.

I thought this would be fairly straight forward using the following service configuration ...

    <xe:restService id="restService1" jsId="restServiceObj"
        pathInfo="pathinfo">
        <xe:this.service>
            <xe:viewItemFileService
                viewName="DocsByUsername" var="rsEntry"
                contentType="application/json" defaultColumns="true"
                sortColumn="Username" categoryFilter="#{sessionScope.username}">
            </xe:viewItemFileService>
        </xe:this.service>
    </xe:restService>

When I preview the page and append the /pathinfo to the url to test the service the following error is returned ...

{
   "code":500,
   "text":"Internal Error",
   "message":"",
   "type":"text",
   "data":"java.lang.NullPointerException\r\n\tat 
      ... removed for space ...

}

If I switch from xe:viewFileItemService to xe:viewJsonService the data is properly returned without error.

Can I not specify a Categorized view for xe:viewFileItemService ?


Solution

  • Use parameter keys instead of categoryFilter. That gives you back all documents for username's category.

    ... keys="#{sessionScope.username}">
    

    enter image description here

    Steve Zavocki had a blog about this issue a while ago.