From: Sven Schöling Date: Wed, 3 Jul 2013 17:24:20 +0000 (+0200) Subject: caching der Widget und javascriptteile nach js/ verschoben X-Git-Tag: release-3.1.0beta1~186 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5cec90adf75c31ded8818f1348341563133daec7;p=kivitendo-erp.git caching der Widget und javascriptteile nach js/ verschoben --- diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index 6be8bb18a..66123e8af 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -1,5 +1,6 @@ namespace('kivi', function(k){ - k.part_picker = function($real, options) { + k.PartPickerCache = { } + k.PartPicker = function($real, options) { var o = $.extend({ limit: 20, delay: 50, @@ -64,6 +65,19 @@ namespace('kivi', function(k){ set_item({ id: last_real, name: last_dummy }) } + function update_results () { + $.ajax({ + url: 'controller.pl?action=Part/part_picker_result', + data: { + 'filter.all:substr::ilike': function(){ var val = $('#part_picker_filter').val(); return val === undefined ? '' : val }, + 'filter.type': $type.val(), + 'column': $column.val(), + 'real_id': $real.val, + }, + success: function(data){ $('#part_picker_result').html(data) } + }); + }; + $dummy.autocomplete({ source: function(req, rsp) { $.ajax($.extend(o, { @@ -129,11 +143,21 @@ namespace('kivi', function(k){ $dummy.after(pcont); pcont.append(picker); picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog); + + return { + real: function() { return $real }, + dummy: function() { return $dummy }, + type: function() { return $type }, + column: function() { return $column }, + update_results: update_results, + set_item: set_item, + reset: make_defined_state, + } } }); $(function(){ $('input.part_autocomplete').each(function(i,real){ - kivi.part_picker($(real)); + kivi.PartPickerCache[real.id] = new kivi.PartPicker($(real)); }) }); diff --git a/templates/webpages/part/_part_picker_result.html b/templates/webpages/part/_part_picker_result.html index cae8d17f8..c6a814335 100644 --- a/templates/webpages/part/_part_picker_result.html +++ b/templates/webpages/part/_part_picker_result.html @@ -26,18 +26,14 @@ [% L.paginate_controls(target='#part_picker_result', selector='#part_picker_result') %]