Live page questions


Once again I ask for help, I can not solve the problem myself.

When editing a page depending on the values in List1, dynamically generate List2
List 1:

#if($context.action == 'edit') 

  {{html wiki="true"}}
  <select id="List1">
    <optgroup label="Group1">
    <optgroup label="Group2">
    #set($selVal = $request.getParameter('selVal'))
    $doc.set('hdwType', $selVal)




List 2
Type: Database List based oh HQL Query.
On change event in List1 send the selected value as a parameter in the HQL Query of List2.

Part of JSX Code:

hdwTypeSelect.change(function() {

function sendTypeValue(typeValue) {
  var UrlParams = {'xpage': 'plain','outputSyntax': 'plain', 'typeValue': typeValue};
    new Ajax.Request(docUrl, {
      parameters: UrlParams,
      onSuccess : function(response) {

  function getTypeValue() {
    /*temporarily hardcoded some values*/
    #set ($document = $xwiki.getDocument('HardwareInventory.testPage1')) 
    #set ($resp = $request.getParameter("typeValue"))
    // Questions:

    //  1. How to debug $resp? Alert('$resp') doesn't work.
    //  2. How to access the property 'Hibernate Query'? Is programming rights required?
    //  3. Is implementation correct generally?


Now problem simplified to:

how to access and set the Database List’s property ‘Hibernate Query’? Is programming rights required?


As far as I understand the author of the document containing the class need at least SCRIPT right (that field is actually interpreted as a Velocity script which generate a HQL statement). Then it depend on what you use in the query, the following rules apply:

1 Like

I expect something like:

function setSubTypeValue() {
    #set ($document = $xwiki.getDocument('HardwareInventory.testPage1')) 
    #set ($resp = $request.getParameter("typeValue"))

    #set ($document.setParameter("hdwSubType")).HQLQueryParam1 = $resp)

How to access the Hibernate Query property of the Database List component in realtime and redefine it?


Well, with plenty of troubles, I discovered that there is no way to realize my idea :frowning:
Realized only one working version by example from mailing list:

#set($classDoc = $xwiki.getDocument('HardwareInventory.Code.HardwareInventoryClass'))
#set($propertyDefinition = $classDoc.getxWikiClass().get('hdwSubTypeList'))
## $propertyDefinition.class should now print com.xpn.xwiki.api.PropertyClass
## Unfortunately, at this point you need programming rights to go into the inner, protected property definition
#set($propertyDefinition = $propertyDefinition.getPropertyClass())
## $propertyDefinition.class should now print com.xpn.xwiki.objects.classes.StaticListClass
## If it doesn't, then you don't have programming rights.
## Don't forget to save

But a major disadvantage is that the class is modified, not the document.
Also it will not work for users without programming rights.

I will try to go in another direction: refuse to use *List components. But here’s another problem: I need a columnar filter with multiple choices. Livetable Multilist column type is ideal, but it works only with *List components and doesn’t support String fields.
Are there any tricks to make it work with String fields?
How else can I implement a multifilter with checkboxes in Livetable?


I have not yet advanced in solving the goal.
Who would suggest?