Suggestion
First issue, Selectmode is createable,
- select text on list,
- type anything not in the list
- Dont press tab, just click other button etc It will trigger blur event but the value still the value of number 1 above / previous value Because most people like to hit save button (not press tab) after they change their inputpicker value
Second issue, Please make update data list easy, right now i update data list by select $('#..').inputpicker({ .. }) again, it will create new inputpicker again (the id of that inputpicker is different), and sometimes it will mess up with tabindex
Third, if you can please make enter behave like tab, cause many people like to hit enter after they input data
thanks
I solve my self
For first issue i change blur event
function _eventBlur(e) { var input = _i($(this)); var original = _o($(this)); if( _selectModeIsCreatable(input)) { if(!_inputValueEqualToOriginalValue(input)){ original.val(input.val()); } }
and i changed this too, so the first new text will get value
function _inputValueEqualToOriginalValue(input) { dd("_inputValueEqualToOriginalValue: _i(" + _i(input).val() + ") == _o(" + _o(input).val() + ")" ); var captain=true; captain=_i(input).data('value') == _o(input).val(); if(_o(input).val()==""){ captain=false} return captain; }
And for 3rd issue i change enter key event , so it behave like tab
case 13: // Enter e.preventDefault(); // Prevent from submitting form methods.toggle.call(input, e); if ( _setValueByActive(input) ){ _o(input).trigger('change'); } else{ _setValueForInput(input); _hideWrappedList(); } var idx = parseInt($(this).attr('tabindex')); idx++; var ada = $('[tabindex=' + idx + ']').length; if (ada != 1) { idx = 1 } if($('[tabindex=' + idx + ']').length>0){ $('[tabindex=' + idx + ']').focus(); $('[tabindex=' + idx + ']').select(); } break;
And for second issue, well it's no problem just for now so dont change anything for it
Hi @fammifarendra , Thank you very much for your suggestion, can you please pull a request with your code so I can merge it straight away.
Hi, ehm.. i dont know how to do pull request
well, i modified again so inputpicker can search with wildcard,
example we type red car, inputpicker will search for *red*car*