Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 26ab499f

Von Sven Schöling vor etwa 13 Jahren hinzugefügt

  • ID 26ab499f25452b9f9d4ef04fdc4a12ecf05d3702
  • Vorgänger ef90159c
  • Nachfolger 8084ef35

Testseite für part autocomplete

Conflicts:

templates/webpages/part/ajax_autocomplete.html

Unterschiede anzeigen:

templates/webpages/part/ajax_autocomplete.html
1
[%- USE HTML %][%  USE JSON %][
1
[%- USE HTML %][% USE JSON %][
2 2
[%- FOREACH part = SELF.parts %]
3 3
[%- ajax_autocomplete__label = part.partnumber _ " " _ part.description %]
4 4
 {
templates/webpages/part/testpage.html
1
[% USE L %]
2
[% USE T8 %]
3
[% USE LxERP %]
4
[% L.javascript_tag('jquery', 'jquery-ui') %]
5
<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.12.custom.css" type="text/css" />
6

  
7
<p>Pick a part</p>
8
id: [% L.input_tag('part_id', '') %]
9
nr: [% L.input_tag('part_partnumber', '') %]
10
desc: [% L.input_tag('part_description', '') %]
11

  
12
<script type='text/javascript'>
13
function autocomplete_part (selector, column, type) {
14
  $(function(){ $(selector).autocomplete({
15
    source: function(req, rsp) {
16
      $.ajax({
17
        url: 'controller.pl?action=Part/ajax_autocomplete',
18
        dataType: "json",
19
        data: {
20
          column: column,
21
          term: req.term,
22
          current: function() { $('#part_id').val() },
23
          type: type,
24
          obsolete: 0,
25
        },
26
        success: function (data){ rsp(data) }
27
      });
28
    },
29
    limit: 20,
30
    delay: 50,
31
    select: function(event, ui) {
32
      $('#part_id').val(ui.item.id);
33
      $('#part_partnumber').val(ui.item.partnumber);
34
      $('#part_description').val(ui.item.description);
35
    },
36
  })});
37
}
38
autocomplete_part('#part_partnumber', 'partnumber', ['part', 'assembly']);
39
autocomplete_part('#part_description', 'description', ['part', 'assembly']);
40
</script>

Auch abrufbar als: Unified diff