Revision a8617d4c
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
js/autocomplete_part.js | ||
---|---|---|
25 | 25 |
$dummy.val(ui.item.name); |
26 | 26 |
}, |
27 | 27 |
}); |
28 |
|
|
29 |
var open_dialog = function(){ |
|
30 |
open_jqm_window({ |
|
31 |
url: 'controller.pl', |
|
32 |
data: { |
|
33 |
action: 'Part/part_picker_search', |
|
34 |
real_id: function() { return $(real).attr('id') }, |
|
35 |
'filter.all:substr::ilike': function(){ return $dummy.val() }, |
|
36 |
'filter.type': function(){ return $type.val() }, |
|
37 |
'column': function(){ return $column.val() }, |
|
38 |
'real_id': function() { return real.id }, |
|
39 |
}, |
|
40 |
id: 'part_selection', |
|
41 |
}); |
|
42 |
return true; |
|
43 |
}; |
|
28 | 44 |
/* In case users are impatient and want to skip ahead: |
29 | 45 |
* Capture <enter> key events and check if it's a unique hit. |
30 | 46 |
* If it is, go ahead and assume it was selected. If it wasn't don't do |
... | ... | |
57 | 73 |
$dummy.val(data[0].description); |
58 | 74 |
if (event.keyCode == 13) |
59 | 75 |
$('#update_button').click(); |
76 |
} else { |
|
77 |
open_dialog(); |
|
60 | 78 |
} |
61 | 79 |
} |
62 | 80 |
}); |
... | ... | |
68 | 86 |
$dummy.blur(function(){ |
69 | 87 |
if ($dummy.val() == '') |
70 | 88 |
$(real).val(''); |
71 |
}) |
|
89 |
});
|
|
72 | 90 |
|
73 | 91 |
// now add a picker div after the original input |
74 | 92 |
var pcont = $('<span>').addClass('position-absolute'); |
75 | 93 |
var picker = $('<div>'); |
76 | 94 |
$dummy.after(pcont); |
77 | 95 |
pcont.append(picker); |
78 |
picker.addClass('icon16 CRM--Schnellsuche').click(function(){ |
|
79 |
open_jqm_window({ |
|
80 |
url: 'controller.pl', |
|
81 |
data: { |
|
82 |
action: 'Part/part_picker_search', |
|
83 |
real_id: function() { return $(real).attr('id') }, |
|
84 |
'filter.all:substr::ilike': function(){ return $dummy.val() }, |
|
85 |
'filter.type': function(){ return $type.val() }, |
|
86 |
'column': function(){ return $column.val() }, |
|
87 |
'real_id': function() { return real.id }, |
|
88 |
}, |
|
89 |
id: 'part_selection', |
|
90 |
}); |
|
91 |
return true; |
|
92 |
}); |
|
96 |
picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog); |
|
93 | 97 |
}); |
94 | 98 |
}) |
Auch abrufbar als: Unified diff
bei enter und nicht eindeutig -> dialog öffnen