namespace('kivi', function(k){
- k.PartPickerCache = { }
k.PartPicker = function($real, options) {
+ // short circuit in case someone double inits us
+ if ($real.data("part_picker"))
+ return $real.data("part_picker");
+
var o = $.extend({
limit: 20,
delay: 50,
pcont.append(picker);
picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog);
- return {
+ var pp = {
real: function() { return $real },
dummy: function() { return $dummy },
type: function() { return $type },
});
}
}
+ $real.data('part_picker', pp);
+ return pp;
}
});
$(function(){
$('input.part_autocomplete').each(function(i,real){
- kivi.PartPickerCache[real.id] = new kivi.PartPicker($(real));
+ kivi.PartPicker($(real));
})
});
[% L.paginate_controls(target='#part_picker_result', selector='#part_picker_result') %]
<script type='text/javascript'>
- var pp = kivi.PartPickerCache[$('#part_picker_real_id').val()];
- pp.init_results();
+ kivi.PartPicker($('#'+$('#part_picker_real_id').val())).init_results()
</script>
<script type='text/javascript'>
var timer;
- var pp = kivi.PartPickerCache['[% FORM.real_id %]'];
+ var pp = kivi.PartPicker($('#[% FORM.real_id %]'));
$(function(){
$('#part_picker_filter').focus();
pp.update_results();