How to reference the oxy_combobox list by button

Oxygen general issues.
sia
Posts: 12
Joined: Tue Sep 17, 2019 1:22 am

How to reference the oxy_combobox list by button

Post by sia »

Hi all,
I want to change the combobox values based on a button.
Button A should trigger a different xslt query for the combobox and button B should trigger another query.
The comboboxes are at the text level and not for an attribute.
For eg:-

Oxy combobox:- It has to be by default

Code: Select all

book:{
  content: oxy_combobox(edit, '#text', values, oxy_xpath('string-join(doc("abc.xml")//meta:v[not(matches(.,\'E$\'))],",")'),columns, 30) ;
}

Code for button 1:-

Code: Select all

book:after(101){
content:
        oxy_button(  
            color, #AAAAAA,
            action,
            oxy_action(
                name, 'E',
                
                description, 'E', 
                operation, 'ro.sync.ecss.extensions.commons.operations.ChangeAttributeOperation', 
                arg-elementLocation,'//book',
                arg-values, 'string-join(doc("def.xml")//meta:v[not(matches(.,\'E$\'))],",")',
                arg-removeIfEmpty, false
            ), 
            transparent, true,
            actionContext, element,
            showIcon, true
        );
}
Code for button 2:-

Code: Select all

book:after(102){
content:
        oxy_button(  
            color, #AAAAAA,
            action,
            oxy_action(
                name, 'S',
                
                description, 'S', 
                operation, 'ro.sync.ecss.extensions.commons.operations.ChangeAttributeOperation', 
                arg-elementLocation,'//book',
                arg-values, 'string-join(doc("abc.xml")//meta:v[not(matches(.,\'S$\'))],",")',
                arg-removeIfEmpty, false
            ), 
            transparent, true,
            actionContext, element,
            showIcon, true
        );
}
Now if anyone clicks on Button E it has to update the combobox xpath
whereas if Button S is clicked , it has to update the xpath fetching S values
Please highlight how to achieve it .
Many thanks in advance for the solution..

Warm regards,
Sia
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: How to reference the oxy_combobox list by button

Post by alex_jitianu »

Hello,

If we have just two buttons involved, then we can do it with a pseudo class:

Code: Select all

book:after{
  content: oxy_combobox(edit, '#text', values, oxy_xpath('string-join(doc("abc.xml")//*:v[not(matches(.,\'E$\'))],",")'),columns, 30) ;
}

book:-e-mode:after{
  content: oxy_combobox(edit, '#text', values, oxy_xpath('string-join(doc("abc.xml")//*:v[not(matches(.,\'S$\'))],",")'),columns, 30) ;
}


book:after(101){
content:
        oxy_button(  
            color, #AAAAAA,
            action,
            oxy_action(
                name, 'E',
                operation, 'SetPseudoClassOperation', 
                arg-name, '-e-mode'
            ), 
            transparent, true
        );
}


book:after(102){
content:
        oxy_button(  
            color, #AAAAAA,
            action,
            oxy_action(
                name, 'S',
                operation, 'RemovePseudoClassOperation', 
                arg-name, '-e-mode'
            ), 
            transparent, true
        );
}


book:-e-mode:after(101) {
    border: 1px solid red;
}

book:not(:-e-mode):after(102) {
    border: 1px solid red;
}

* {
    display:block;
}
Best regards,
Alex
sia
Posts: 12
Joined: Tue Sep 17, 2019 1:22 am

Re: How to reference the oxy_combobox list by button

Post by sia »

Thank you for this solution.
sia
Posts: 12
Joined: Tue Sep 17, 2019 1:22 am

Re: How to reference the oxy_combobox list by button

Post by sia »

Is there any way to clear the previous selection in oxy_combobox, when using the toggle button ( TogglePseudoClass) ?
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: How to reference the oxy_combobox list by button

Post by alex_jitianu »

Hello,

You can chain 2 actions, one of which will delete the text content of the element:

Code: Select all

book:after(101){
content:
        oxy_button(  
            color, #AAAAAA,
            action,
            oxy_compound_action(
                    name, 'E',
                    description, 'Insert an "element" and then rename it to "rename"',
            oxy_action(
                name, 'E',
                operation, 'SetPseudoClassOperation', 
                arg-name, '-e-mode'
            ),
           	oxy_action(
           	    name, 'Remove', 
           	    description, 'Renames the current element', 
           	    operation, 'XQueryUpdateOperation',
           	    arg-script, 'replace value of node . with ""'
           	)
           ), 
            transparent, true
        );
}
Best regards,
Alex
sia
Posts: 12
Joined: Tue Sep 17, 2019 1:22 am

Re: How to reference the oxy_combobox list by button

Post by sia »

That's great . Thank you.

Best,
Sia
Post Reply