Struts2 How to dynamically apply a comparator to a given List - struts2

Is it possible to apply one of the comparators on a List based on a drop down selection?
For example, I have two comparators defined:
<s:bean name="comparator.CreateDateComparator" var="createDateComparator"/>
<s:bean name="comparator.LastUpdatedDateComparator" var="lastDateComparator"/>
Based on a certain selected value from a dropdown, I would like use the right comparator for my sorting. Something like this:
<s:if test="dropDownValue=='CREATE_DATE'" >
<s:sort comparator="createDateComparator" source="dataList">

Related

Create a query params with combobox in Foxx

I wonder if I can create a query param that take multiple values from dropdown just like a non-typing combobox in the UI of ArangoDB. For example
//A route....
.queryParam('A', joi.any().allow(["true","false,"haha"]).required().default("true"))
The one above produce an dropdow that allow you to choose only 1 value. Is it possible to make them behave like a combo box on arango's UI?
I use this query param join's validation that shows as a drop down in the Arango UI
.queryParam('direction', joi.string().lowercase().valid('inbound', 'outbound', 'any')
.required().description('Direction of traversal from given product (inbound/outbound/any)'
))

Rails 4 Active record, search by attribute that contains an array?

I want to search by an attribute that contains an array. I'm interested in returning all records where the array in this attribute contains a specific value.
example object
Location_1 {
regions: ["on", "qc"]
}
I want to do something like this Location.where(regions: "on"), but I'm not sure of the correct syntax.
what is the right way to do this?
Try this Location.where('regions in (?)', ['on','qc'])
The IN operator allows you to specify multiple values in your WHERE clause.

Jenkins - Dynamic Extended Choice parameter to populate multi-level multi-select list

Is there a way to use the Dynamic (Moded) Extended Choice Parameter to bind with an Extended Choice Parameter multi-level field to populate the first level's list?
For example if I had:
This would bind with this field below:
Either by having the first level (Choice) default with their ModedChoice selection (Choice1,Choice2,Choice3), or based on their ModedChoice selection 'Value1' would be populated (I would take the Choice level out in that case).
I know the second method I mentioned can be done for a single select list as described on the wiki and it would search for the text file Choice1.txt, Choice2.txt etc., which would contain Value1 values (i.e. key=value1.1,value1.2,value1.3 etc).
I couldn't figure out how to have that key contain a multi level list since it is a tab delimited format to separate columns, i.e:
Choice Value1 Value2
choice1 value1.1 value2.1
choice1 value1.1 value2.2
choice2 value1.2 value2.1
choice2 value1.1 value2.5
choice3 value1.2 value2.7
etc..
I tried something like (Choice1.txt):
key='Value1 Value2
value1.1 value2.1
value1.1 value2.2
value1.2 value2.1
value1.1 value2.5
value1.2 value2.7'
etc.. for Choice2.txt and Choice3.txt.
But this just populates the multi level with Value1 Value2.
I tried binding with another Moded Choice Parameter (Multi Select), and left the Key field empty and kept the proper tab delimited format for the multi level select list, but it still outputs Value1 Value2.

how to define different widgets for different rows in dgrid

The dgrid Editor is a column-level plugins, which controls the whole column behavior.
Suppose I have a list of parameters, each has different value type that I want to show in different widgets. For example:
param1 value1(bool, shown as a checkbox)
param2 value2(string, shown as a text input)
param3 value3(enum, shown as a combobox)
param4 value4(int, shown as a NumberSpinner)
....
All the values are in the second column in the dgrid, but they are different types. How do I apply the Editor plugin to the cell level? Is there any method I can use to control individual cell in dgrid?
Thanks.

Orbeon - how to get or set checkboxes

I have a simple questio: how to get/set checkbox from checkboxes in orbeon?
Something like this:
/myCheckboxes[value="itemVal"].isChecked()
That's right, the values are space-separated. To extract them, instead of contains() use this to check if value 42 is included:
tokenize(../myCheckboxGroup, '\s+') = '42'
This splits the value on spaces with the \s+ regexp and returns a string sequence.
By the way you don't need to write:
if (condition) true() else false()
You can always just write:
condition
i've made something like this:
to set: simply set value of checkbox group as a string compound by all items values i want to have checked separated by a space.
To check if checkbox is checked i`ve made something like this:
if(contains(../myCheckboxGroup, '2')) then true() else false()
but its not good solution for example because it's making that max items is 10 if i want to add values as a successive integers.

Resources