-
1. Re: Can't choose value from rich select with enableManualInput if value is substring of another value
hr6134 Jan 28, 2014 12:04 AM (in response to hr6134)I'm read richfaces source a little and maybe I found why this bug appear.
First of all is __save function in select.js (richfaces component repos). We have 2 different paths based on this.enableManualInput is true or false. As I say, bug reproduced only if this option is on. In this case we call
__getClientItemFromCache(inputLabel). if (this.enableManualInput) { clientSelectItem = this.__getClientItemFromCache(inputLabel); } else { clientSelectItem = this.__getClientItem(inputLabel); }
In inputLabel is 'gasoline' and we have it in cache (list of 4 items). If we step into __getClientItemFromCache we see that it takes only fist element of list (anyway, why it takes just first element?) and unfortunately it's not "our" element.
var items = this.cache.getItems(inputLabel, this.filterFunction);
if (items && items.length > 0) { var first = $(items[0]); $.each(this.clientSelectItems, function() { if (this.id == first.attr("id")) { label = this.label; value = this.value; return false; } });
So, here 2 way to solve the problem: clear cache before method call, or use __getClientItem(inputLabel) as we do when enableManualInput is off.
I'm not strong in JavaScript, english , and, that importantly, I'm not strong in richfaces sources. It will be a pleasure if some of devs look at this code and write some words to us.
-
2. Re: Can't choose value from rich select with enableManualInput if value is substring of another value
bleathem Jan 28, 2014 12:05 AM (in response to hr6134)This sounds vaguely familiar. Can you try a recent version of RichFaces to see if it's been fixed already?
-
3. Re: Can't choose value from rich select with enableManualInput if value is substring of another value
hr6134 Jan 29, 2014 2:43 PM (in response to bleathem)Yes. I already found this issue in bug tracker:
[RF-12613] rich:select with enablemanualinput selects wrong items - JBoss Issue Tracker
And it's still unresolved.