From jira-events at lists.jboss.org Fri Nov 1 00:14:02 2013 Content-Type: multipart/mixed; boundary="===============6130640869789941314==" MIME-Version: 1.0 From: alexey plotnikov (JIRA) To: richfaces-issues at lists.jboss.org Subject: [richfaces-issues] [JBoss JIRA] (RF-13306) Autocomplete: ignored API call .setValue('') Date: Fri, 01 Nov 2013 00:14:01 -0400 Message-ID: In-Reply-To: JIRA.12509251.1383279199103@jira02.app.mwc.hst.phx2.redhat.com --===============6130640869789941314== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable alexey plotnikov created RF-13306: ------------------------------------- Summary: 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 All described here https://community.jboss.org/thread/233973 I have this autocomplete component: {code} = = = = =
= = = = = = = = = = = = = = = =
{code} as you can see, i don't use showButton=3D"true", because i need another fun= ctionality, i need erase input text before show popup window. I use JavaScript function "autocompleteChangeProvider" for extract selected= id. I use separate button(/img/cancel.png) for erase input text, as you can see= this function just use Richfaces API. = And a problem: if autocomplete.providerName not null and not empty(in rich:autocomplete) a= nd 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, options= ) { = // 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.createNamespace= (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.currentValue= =3D"" so currentValue equal new value("" - empty string), so nothing happen= s. i replace this code by this: {code} rf.ui.AutocompleteBase =3D function(componentId, selectId, fieldId, options= ) { = // 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.createNamespace= (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 --===============6130640869789941314==--