Issue Details (XML | Word | Printable)

Key: XWIKI-347
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Sergiu Dumitriu
Reporter: Sergiu Dumitriu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Extend DBListClass to accept value/label pairs queries

Created: 25/Sep/06 04:12   Updated: 07/Jan/07 07:30
Component/s: Core
Affects Version/s: None
Fix Version/s: 1.0 B2

Resolution Date: 07/Jan/07 07:30


 Description  « Hide
DBListClass uses a query to populate the displayed selectbox with values. It would be useful to be able populate not only the values, but also the displayed text for each value.

For example, i have a colection of objects in the database, each object having an id and a displayed name. Populating the DBListClass with ids enforces the user to lookup/remember ids, and this should be avoided. Populating it with names negates the role of the id.

There are 2 variants for this:

  • add a new field in the Meta class, has_labels
  • detect if the resultset is composed of single values or pairs

Please advise.



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Sergiu Dumitriu added a comment - 07/Jan/07 07:30
Fixed in rev. 1902. When the select returns two columns, the ListProperty.getElementValue and ListProperty.getDisplayedValue return the value, respectively label for the current item. Otherwise, both functions return the same value.