bootstrap-combobox icon indicating copy to clipboard operation
bootstrap-combobox copied to clipboard

Consider adding minimum search/lookup length.

Open cdriver1 opened this issue 8 years ago • 2 comments
trafficstars

Please consider adding a minimum search length for use cases when there is a large number of options and now async calls are available to populate the list. For example I have a list of ~ 2700 employees that is used in conjunction with this combobox and it behaves quite slowly when only one character is entered. Also, when the minimum length is not met the dropdown could be hidden if not shown due to clicking the caret span.

I have implemented this partially myself by adding cases for delete and backspace and changing the default case in the keyup function like so:

   keyup: function (e) {
       // other cases here
       case 8: // backspace
          if (this.$element.val().length < this.minSearchLength) {
              this.hide();
              break;
          } else {
              // fall through to default case.
          }
      case 46: // delete
          if (this.$element.val().length < this.minSearchLength) {
              this.hide();
              break;
          } else {
              // fall through to default case.
          }
      default:
          if (this.$element.val().length > this.minSearchLength-1) {
              this.clearTarget();
              this.lookup();
          }
 }

cdriver1 avatar Dec 30 '16 16:12 cdriver1

I think this could be a really useful feature in case of large datasets; I'd love it

seanVonDrake avatar Jan 29 '18 21:01 seanVonDrake

this would be great

elisamuel40 avatar May 04 '21 00:05 elisamuel40