Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c2d1e374

Von Sven Schöling vor mehr als 11 Jahren hinzugefügt

  • ID c2d1e374b4f8a2b4802ea6348539da7ec10a227a
  • Vorgänger 5cec90ad
  • Nachfolger eff6af28

mehr code nach js/ verlagert

Unterschiede anzeigen:

js/autocomplete_part.js
78 78
      });
79 79
    };
80 80

  
81
    function close_popup() {
82
      $('#part_selection').jqmClose()
83
    };
84

  
81 85
    $dummy.autocomplete({
82 86
      source: function(req, rsp) {
83 87
        $.ajax($.extend(o, {
......
145 149
    picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog);
146 150

  
147 151
    return {
148
      real:     function() { return $real },
149
      dummy:    function() { return $dummy },
150
      type:     function() { return $type },
151
      column:   function() { return $column },
152
      real:           function() { return $real },
153
      dummy:          function() { return $dummy },
154
      type:           function() { return $type },
155
      column:         function() { return $column },
152 156
      update_results: update_results,
153
      set_item: set_item,
154
      reset:    make_defined_state,
157
      set_item:       set_item,
158
      reset:          make_defined_state,
159
      init_results:    function () {
160
        $('div.part_picker_part').each(function(){
161
          $(this).click(function(){
162
            set_item({
163
              name: $(this).children('input.part_picker_description').val(),
164
              id:   $(this).children('input.part_picker_id').val(),
165
            });
166
            close_popup();
167
            return true;
168
          });
169
        });
170
        $('#part_selection').keypress(function(e){
171
           if (e.keyCode == 27) { // escape
172
             close_popup();
173
             $dummy.focus();
174
           }
175
        });
176
      }
155 177
    }
156 178
  }
157 179
});
templates/webpages/part/_part_picker_result.html
27 27

  
28 28
<script type='text/javascript'>
29 29
  var pp = kivi.PartPickerCache[$('#part_picker_real_id').val()];
30
  $('div.part_picker_part').each(function(){
31
    $(this).click(function(){
32
      pp.set_item({
33
        name: $(this).children('input.part_picker_description').val(),
34
        id:   $(this).children('input.part_picker_id').val(),
35
      });
36
      $('#part_selection').jqmClose();
37
      return true;
38
    });
39
  });
30
  pp.init_results();
40 31
</script>

Auch abrufbar als: Unified diff