David B
David B

Reputation: 3581

JQuery autocomplete: trigger <g:select onChange>

As we all know, javax.swing.JComboBox is a dropdown selection having E elements in it. When setting .setEditable(true), we now can make that JComboBox also a JTextField for other E element.

After searching with Google on this, it returned to us a suggestion of using by JQuery about autocomplete presented here. Autocomplete is working on the selection but here's the problem, we need to trigger the onChange attribute that contains the ${remoteFunction} to render a particular template on the update attribute of the said ${remoteFunction}.

<g:select  
  id="itemSelectId"
  onChange="${remoteFunction(
    controller:'item', action:'itemSelect',
    update:[success:'updateItemId'],
    params:'\'id=\' + escape(this.value)'"/>
<div id="updateItemId></div>

And on the <script> provided on the link we just change #combobox to #itemSelectId.

Upvotes: 2

Views: 968

Answers (1)

Chronial
Chronial

Reputation: 70763

Have a look at select2, that library might offer the features you are looking for.

Upvotes: 1

Related Questions