[richfaces-issues] [JBoss JIRA] Created: (RF-11126) Improvement on filtering entries for rich:comboBox
Martin Dames (JIRA)
jira-events at lists.jboss.org
Thu Jul 14 02:02:23 EDT 2011
Improvement on filtering entries for rich:comboBox
--------------------------------------------------
Key: RF-11126
URL: https://issues.jboss.org/browse/RF-11126
Project: RichFaces
Issue Type: Patch
Security Level: Public (Everyone can see)
Components: component-input
Affects Versions: 3.3.3.Final
Environment: Win7, Firefox 3.6.x, JBoss AS 4.2.3, Seam 2.1.2
Reporter: Martin Dames
Priority: Minor
I have an improvement patch for the rich:comboBox. My use case was to filter entries with an input string no matter where it occurs in the entries text. Your component implementation can only search for the string at the beginning of the entries text.
Example:
Entries in comboBox: Seam in Action, Seam with Richfaces, Seam 3, Exadel Richfaces
Old:
Input filter text: Seam; Filter output: Seam in Action, Seam with Richfaces, Seam 3, Exadel Richfaces
Input filter text: Exadel; Filter output: Exadel Richfaces
Input filter text: Richfaces; Filter output: nothing found
Input filter text: in; Filter output: nothing found
New:
Input filter text: Seam; Filter output: Seam in Action, Seam with Richfaces, Seam 3, Exadel Richfaces
Input filter text: Exadel; Filter output: Exadel Richfaces
Input filter text: Richfaces; Filter output: Seam with Richfaces, Exadel Richfaces
Input filter text: in; Filter output: Seam in Action
The patch occurs in combolist.js Javascript found in /org/richfaces/renderkit/html/scripts/combolist.js:
getFilteredItems : function(text) {
var items = new Array();
for (var i = 0; i < this.itemsText.length; i++) {
var itText = this.itemsText[i].toLowerCase();
// New:
if (itText.search(text.toLowerCase()) != -1) {
items.push(this.createItem(itText, this.classes.item.normal));
}
// Old:
//if (itText.substr(0, text.length).toLowerCase() == text.toLowerCase()) { //FIXME: to optimaize
//items.push(this.createItem(itText, this.classes.item.normal));
//}
}
return items;
},
Hope it could be helpful.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list