Free text Custom field searcher for a select box custom field

I create a custom field that very much look like a multi select field ( the transport object is a Map<String, Collection<Option>> ) - I am now trying to write the custom field searcher for it. I want to provide a simple input box for the searching ( so that the options of my custom field do not get listed).

My custom field searcher can extend TextSearcher, but it seems like getSingularObjectFromString is always called - and this returns an option ( preventing me to do searches like myoption* ...

Do you have any references/hints for me?

2 answers

1 accepted

I found a way to solve my problem ! ( following the excellent book from Matt Doar : Practical Jira Plugin) -

For future reference:

I created a custom transformer class that extends the FreeTextCustomFieldSearchInputTransformer but modified the getFieldValueAsString function to not call getSingularObjectFromString for the custom field transport.

The wiring of the transformer with the custom field search is done in the init class of the searcher:

public void init(CustomField field) {

        
        final FieldIndexer indexer = new MultiCascadingSelectCustomFieldIndexer(fieldVisibilityManager, field);
        this.searcherInformation = new CustomFieldSearcherInformation(field.getId(), field.getNameKey(), Collections.&lt;FieldIndexer&gt;singletonList(indexer), new AtomicReference&lt;CustomField&gt;(field));
       
        final ClauseNames names = field.getClauseNames();
        this.searchInputTransformer = new FreeTextMultiSelectCustomFieldSearchInputTransformer(field, names, searcherInformation.getId(), customFieldInputHelper);

        final CustomFieldValueProvider customFieldValueProvider = new SingleValueCustomFieldValueProvider();
        this.searchRenderer = new CustomFieldRenderer(names, getDescriptor(), field, customFieldValueProvider, fieldVisibilityManager);

        this.customFieldSearcherClauseHandler = new SimpleAllTextCustomFieldSearcherClauseHandler(
                new FreeTextFieldValidator(field.getId(), jqlOperandResolver),
                new FreeTextClauseQueryFactory(jqlOperandResolver, field.getId()),
                OperatorClasses.TEXT_OPERATORS, JiraDataTypes.TEXT);

	}


Hello,

How does that exactly work? Does it autocomplete as you type with an item from the list?

I would like to have a custom field that is a single selection list, but my list needs to have lots of items, and I would like to be able to search an item on the list by typing text in a box and have it autocomplete with the available items that match (similar to what the 'assignee' field does with users. Is that how your plugin works?

Thanks

Did you find a solution for the autocomplete on select fields problem?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Thursday in Off-topic

Friday Fun: Magic Eyes

...staring into the background. Once the image pops out in 3D, you can look around the picture and enjoy. If you will see if you are a true illusion master! :) You did it? :) Wow! Awesome! As a bonus...

418 views 79 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you