From jira-events at lists.jboss.org Mon Nov 4 12:26:02 2013 Content-Type: multipart/mixed; boundary="===============6661033527542729560==" MIME-Version: 1.0 From: Brian Leathem (JIRA) To: richfaces-issues at lists.jboss.org Subject: [richfaces-issues] [JBoss JIRA] (RF-13306) Autocomplete: ignored API call .setValue('') Date: Mon, 04 Nov 2013 12:26:02 -0500 Message-ID: In-Reply-To: JIRA.12509251.1383279199000@jira02.app.mwc.hst.phx2.redhat.com --===============6661033527542729560== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/RF-13306?page=3Dcom.atlassian.jira.p= lugin.system.issuetabpanels:all-tabpanel ] Brian Leathem reassigned RF-13306: ---------------------------------- Assignee: Luk=C3=A1=C5=A1 Fry=C4=8D [~lfryc] please assess the proposed fix and schedule accordingly. = > Autocomplete: ignored API call .setValue('') > -------------------------------------------- > > Key: RF-13306 > URL: https://issues.jboss.org/browse/RF-13306 > Project: RichFaces > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Affects Versions: 4.3.4 > Reporter: alexey plotnikov > Assignee: Luk=C3=A1=C5=A1 Fry=C4=8D > > All described here https://community.jboss.org/thread/233973 > I have this autocomplete component: > {code} > = > = > = > = > = >
= > minChars=3D"0" var=3D"s" fetchValue=3D"#{s.re= alName}" id=3D"provider-suggestion" = > autofill=3D"false" = > onselectitem=3D"autocompleteChangeProvider(ev= ent.target)" style=3D"display: inline;" = > layout=3D"table" value=3D"#{autocomplete.prov= iderName}" > = > = > = > = = > = > = > = > = > = > = > = > alt=3D""/> = > onclick=3D"#{rich:component('provider-suggestion= ')}.hidePopup();#{rich:component('provider-suggestion')}.setValue('');autoc= ompleteChangeProvider(null);" = > alt=3D"#{messages['pages.clear']}" title=3D"#{me= ssages['pages.clear']}"/> = > = >
> {code} > as you can see, i don't use showButton=3D"true", because i need another f= unctionality, i need erase input text before show popup window. > I use JavaScript function "autocompleteChangeProvider" for extract select= ed id. > I use separate button(/img/cancel.png) for erase input text, as you can s= ee this function just use Richfaces API. > = > And a problem: > if autocomplete.providerName not null and not empty(in rich:autocomplete)= and user clicks on show button(/img/arrow.png) than input text not erasing= , but i called #{rich:component('provider-suggestion')}.setValue('') !!! > = > I think i found a solution > AutocompleteBase.js has this code: > {code} > rf.ui.AutocompleteBase =3D function(componentId, selectId, fieldId, optio= ns) { = > // call constructor of parent class = > $super.constructor.call(this, componentId); = > this.selectId =3D selectId; = > this.fieldId =3D fieldId; = > this.options =3D $.extend({}, defaultOptions, options); = > this.namespace =3D this.namespace || "." + rf.Event.createNamespa= ce(this.name, this.selectId); = > this.currentValue =3D ""; = > this.tempValue =3D this.getValue(); = > this.isChanged =3D this.tempValue.length !=3D 0; = > bindEventHandlers.call(this); = > }; > {code} > as you can see this.currentValue =3D "" so JS thinks that this.currentVal= ue=3D"" so currentValue equal new value("" - empty string), so nothing happ= ens. > i replace this code by this: > {code} > rf.ui.AutocompleteBase =3D function(componentId, selectId, fieldId, optio= ns) { = > // call constructor of parent class = > $super.constructor.call(this, componentId); = > this.selectId =3D selectId; = > this.fieldId =3D fieldId; = > this.options =3D $.extend({}, defaultOptions, options); = > this.namespace =3D this.namespace || "." + rf.Event.createNamespa= ce(this.name, this.selectId); = > this.currentValue =3D $(rf.getDomElement(fieldId)).val(); = > this.tempValue =3D this.getValue(); = > this.isChanged =3D this.tempValue.length !=3D 0; = > bindEventHandlers.call(this); = > }; > {code} > and it works! -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira --===============6661033527542729560==--