Revision 7a646681
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
js/autocomplete_part.js | ||
---|---|---|
18 | 18 |
var last_dummy = $dummy.val(); |
19 | 19 |
var open_dialog = function(){ |
20 | 20 |
open_jqm_window({ |
21 |
url: 'controller.pl', |
|
22 |
data: { |
|
23 |
action: 'Part/part_picker_search', |
|
21 |
url: 'controller.pl?action=Part/part_picker_search', |
|
22 |
data: $.extend({ |
|
24 | 23 |
real_id: real_id, |
25 |
'filter.all:substr::ilike': function(){ return $dummy.val() }, |
|
26 |
'filter.type': function(){ return $type.val() }, |
|
27 |
'column': function(){ return $column.val() }, |
|
28 |
}, |
|
24 |
}, ajax_data($dummy.val())), |
|
29 | 25 |
id: 'part_selection', |
30 | 26 |
}); |
31 | 27 |
return true; |
... | ... | |
33 | 29 |
|
34 | 30 |
function ajax_data(term) { |
35 | 31 |
return { |
36 |
term: term, |
|
37 |
type: function() { return $type.val() }, |
|
32 |
'filter.all:substr::ilike': term, |
|
33 |
'filter.type': function() { return $type.val() }, |
|
34 |
'filter.obsolete': 0, |
|
38 | 35 |
column: function() { return $column.val()===undefined ? '' : $column.val() }, |
39 | 36 |
current: function() { return $real.val() }, |
40 |
obsolete: 0, |
|
41 | 37 |
} |
42 | 38 |
} |
43 | 39 |
|
... | ... | |
68 | 64 |
function update_results () { |
69 | 65 |
$.ajax({ |
70 | 66 |
url: 'controller.pl?action=Part/part_picker_result', |
71 |
data: { |
|
72 |
'filter.all:substr::ilike': function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val }, |
|
73 |
'filter.type': $type.val(), |
|
74 |
'column': $column.val(), |
|
75 |
'real_id': $real.val, |
|
76 |
}, |
|
67 |
data: $.extend({ |
|
68 |
'real_id': $real.val(), |
|
69 |
}, ajax_data(function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val })), |
|
77 | 70 |
success: function(data){ $('#part_picker_result').html(data) } |
78 | 71 |
}); |
79 | 72 |
}; |
Auch abrufbar als: Unified diff
ajax_autocomplete umgestellt auf get_models und inline JSON (20% schneller als template)