var state = STATES.PICKED;
var last_real = $real.val();
var last_dummy = $dummy.val();
- var open_dialog = function(){
+ var timer;
+
+ function open_dialog () {
open_jqm_window({
url: 'controller.pl?action=Part/part_picker_search',
data: $.extend({
}, ajax_data($dummy.val())),
id: 'part_selection',
});
+ window.clearTimeout(timer);
return true;
- };
+ }
function ajax_data(term) {
var data = {
});
};
+ function result_timer (event) {
+ window.clearTimeout(timer);
+ timer = window.setTimeout(update_results, 100);
+ }
+
function close_popup() {
$('#part_selection').jqmClose()
};
}
});
-// $dummy.blur(make_defined_state); // blur triggers also on open_jqm_dialog
+ $dummy.blur(function(){
+ window.clearTimeout(timer);
+ timer = window.setTimeout(make_defined_state, 100);
+ });
// now add a picker div after the original input
var pcont = $('<span>').addClass('position-absolute');
convertible_unit: function() { return $convertible_unit },
column: function() { return $column },
update_results: update_results,
+ result_timer: result_timer,
set_item: set_item,
reset: make_defined_state,
init_results: function () {
</div>
<script type='text/javascript'>
- var timer;
var pp = kivi.PartPicker($('#[% FORM.real_id %]'));
$(function(){
$('#part_picker_filter').focus();
pp.update_results();
});
- $('#part_picker_filter').keypress(function (event){
- window.clearTimeout(timer);
- timer = window.setTimeout(pp.update_results, 100);
- });
+ $('#part_picker_filter').keypress(pp.update_results);
</script>