Reputation: 4490
I am inserting values into a web page somewhat like an automated test environment.
A valid value is set on a search input text field. Normally the user types a code and the selection list shows the code and the description. When the user selects a value there is additional processing that happens.
After the value is set onto the field I would like it to automatically select the first entry (because there will be only one).
As of 2.2 I know there is a selectFirstResult option for the search fields. However, I don't want to set that as a permanent setting in the page, I just need it for this operation. Is it possible to set just that flag once the page is fully loaded and after the field has already been initialized as a search? When I attempted to do it I lost all the original search settings for that field.
Upvotes: 2
Views: 725
Reputation: 5534
To modify existing settings of a search (or any component), you can use the setting
property which will not discard your original search settings.
// To enable selectFirstResult
$('.ui.search').search('setting', { selectFirstResult: true });
// To disable selectFirstResult
$('.ui.search').search('setting', { selectFirstResult: false });
Upvotes: 2