Need guidance/pointers to filter using liveData where the datasource is liveTable

I built an application using Application In Minutes. On another page I would like to present a subset of data using liveData but am having trouble understanding the documentation on how to do such. For example, the liveTable source class has properties “group, name, email, phone”. On a separate page, I wish to display the data for just a specific group.

I see this in the liveData documenation

  • queryFilters (default value: currentlanguage,hidden)
    • see Query Module for more details on the filters
    • with those filters, the content is translated to the locale of the user and hidden pages are only displayed when Display hidden pages is set to Yes in the user preferences

But I don’t understand how to use that and extend that to do something like group=xxx.

Any pointers will be greatly appreciated!

Hello @bbergquist0930,

I created a “Demo” AWM app with the same properties as you (group, name, email, phone).

See the group key in the sourceParameters.

{{liveData
  id="demo"
  properties="group,name,email,phone,_actions"
  source="liveTable"
  sourceParameters="className=Demo.Code.DemoClass&translationPrefix=demo.livetable.&group=XWiki.XWikiAdminGroup"
/}}

The corresponding explanation is in https://extensions.xwiki.org/xwiki/bin/view/Extension/Livetable%20Macro#HAllacceptedvalues (see extraParams), but I’ll add some detail in https://extensions.xwiki.org/xwiki/bin/view/Extension/Live%20Data%20Macro/ to make it easier to find.

Got it! That was exactly what I needed. Thank you very much!

Actually another question. It seems that I have to include group in the properties to be able to filter on group. My real goal is to have a group specific page where the data is for the filtered group, but remove the ability for the user viewing the page to enable change the group. Basically a fixed unchangeable filter for the group.

This seems to refer to what I want from the liveData documenation and the JSON customization

{
  //
  // The query
  //

  "query": {
    // The list of properties to fetch.
    "properties": ["title", "year", ...],

    "source": {
      // The component hint of the live data source
      "id": "...",

      // Parameters specific to each live data source implementation. This can also be used to implement hidden filters, that the user cannot change from the live data UI.
      "customParam1": "...",
      ...
    },

I’ve used the id of liveTable (not sure that is correct but it seems to be) and className being the class, but I don’t know how to achieve the fixed filter.

One easy option is to declare the group property, but to hide it.

{{liveData
  id="demo"
  properties="group,name,email,phone,_actions"
  source="liveTable"
  sourceParameters="className=Demo.Code.DemoClass&translationPrefix=demo.livetable.&group=XWiki.XWikiAdminGroup"
}}{
  "meta": {
    "propertyDescriptors": [{ "id": "group", "visible": false }]
  }
}{{/liveData}}

Note that users familiar with the advanced UI features of Live Data would be able to show the property, but it wouldn’t be visible by default.
Otherwise, I think you need to define you own custom source. Unless @mflorea has another idea?

That is what I have come up with for now as well. I have it hidden. I also set the filterable descriptor property to false and the sortable descriptor property to false. At the worst, the user can use the Properties dialog and enable the field, but cannot really do anything with it.

That is likely fine and I will mark this solved!

Again, this help is much appreciated.

1 Like