Revision 715fc205
Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt
SL/Presenter/Part.pm | ||
---|---|---|
245 | 245 |
parts will be used for autocompletion which partnumber is a vendor partnumber |
246 | 246 |
(makemodel) or a customer partnumber. |
247 | 247 |
|
248 |
If C<%params> contains C<multiple> an alternative popup will be opened, |
|
249 |
allowing multiple items to be selected. Note however that this requires |
|
250 |
an additional callback C<set_multi_items> to work. |
|
251 |
Also note that you can set C<multiple> to 0 (or not set C<multiple>) on |
|
252 |
creation of the picker, but can open the alternative multi select popup |
|
253 |
with js like this: |
|
254 |
C<$("#pp_id").data("part_picker").o.multiple=1; $("#pp_id").data("part_picker").open_dialog()'> |
|
255 |
where C<pp_id> is the dom id of the part picker. |
|
256 |
Or you can even do it the other way round setting C<multiple> to 1 on creation |
|
257 |
and open a single selection popup with js. |
|
258 |
|
|
248 | 259 |
Obsolete parts will by default not be displayed for selection. However they are |
249 | 260 |
accepted as default values and can persist during updates. As with other |
250 | 261 |
selectors though, they are not selectable once overridden. |
... | ... | |
278 | 289 |
undefined. |
279 | 290 |
|
280 | 291 |
After that the action C<commit_one> will be executed, which defaults to |
281 |
opening a popup dialog for graphical interaction. If C<params> contains |
|
282 |
C<multiple> an alternative popup will be opened, allowing multiple items to be |
|
283 |
selected. Note however that this requires an additional callback |
|
284 |
C<set_multi_items> to work. |
|
292 |
opening a popup dialog for graphical interaction. |
|
285 | 293 |
|
286 | 294 |
=item * C<commit_none> |
287 | 295 |
|
js/kivi.Part.js | ||
---|---|---|
323 | 323 |
this.last_dummy = this.$dummy.val(); |
324 | 324 |
this.timer = undefined; |
325 | 325 |
this.dialog = undefined; |
326 |
this.multiple_default = this.o.multiple; |
|
326 | 327 |
|
327 | 328 |
this.init(); |
328 | 329 |
}; |
... | ... | |
487 | 488 |
}, |
488 | 489 |
open_dialog: function() { |
489 | 490 |
if (this.o.multiple) { |
491 |
this.o.multiple = this.multiple_default; |
|
490 | 492 |
this.dialog = new ns.PickerMultiPopup(this); |
491 | 493 |
} else { |
492 | 494 |
this.dialog = new ns.PickerPopup(this); |
templates/webpages/part/test_page.html | ||
---|---|---|
26 | 26 |
[% P.part.picker('part_id14', undef, classification_id='1,2,4') %]<br> |
27 | 27 |
Artikel-Status: Aktiv (default)<br> |
28 | 28 |
[% P.part.picker('part_id15') %]<br> |
29 |
Artikel-Status: Aktiv< (explizit)<br>
|
|
29 |
Artikel-Status: Aktiv (explizit)<br> |
|
30 | 30 |
[% P.part.picker('part_id16', undef, status="active") %]<br> |
31 | 31 |
Artikel-Status: Ungültig<br> |
32 | 32 |
[% P.part.picker('part_id17', undef, status="obsolete") %]<br> |
... | ... | |
41 | 41 |
With multi select popup<br> |
42 | 42 |
[% P.part.picker('part_id8', undef, multiple=1) %]<br> |
43 | 43 |
With multi select popup (only obsolete)<br> |
44 |
[% P.part.picker('part_id8', undef, multiple=1, status='obsolete') %]<br>
|
|
44 |
[% P.part.picker('part_id9', undef, multiple=1, status='obsolete') %]<br>
|
|
45 | 45 |
<br> |
46 | 46 |
All parts including make models of all vendors: <br> |
47 |
[% P.part.picker('part_id', undef, with_makemodel=1) %]<br> |
|
47 |
[% P.part.picker('part_id21', undef, with_makemodel=1) %]<br>
|
|
48 | 48 |
All parts including make models of all vendors with multi select popup: <br> |
49 |
[% P.part.picker('part_id', undef, with_makemodel=1, multiple=1) %]<br> |
|
49 |
[% P.part.picker('part_id22', undef, with_makemodel=1, multiple=1) %]<br>
|
|
50 | 50 |
All parts including customer partnumbers of all customers: <br> |
51 |
[% P.part.picker('part_id', undef, with_customer_partnumber=1) %]<br> |
|
51 |
[% P.part.picker('part_id23', undef, with_customer_partnumber=1) %]<br> |
|
52 |
<br> |
|
53 |
single select dialog for glass-popup-button; multi select with extra button:<br> |
|
54 |
[% P.part.picker('part_id31', undef, multiple=0) %] |
|
55 |
[% L.button_tag('$("#part_id31").data("part_picker").o.multiple=1; $("#part_id31").data("part_picker").open_dialog()', 'Add multiple items') %]<br> |
|
52 | 56 |
|
53 | 57 |
<h2>Styling</h2> |
54 | 58 |
|
Auch abrufbar als: Unified diff
PartPicker: Option für Mehrfachauswahl als default merken
Damit lässt sich die Option via js ändern, um z.B. einen Dialog
mit Mehrfachauswahl über einen Knopf zu öffnen, während die
Funktion der Lupe bei der Einfachauswahl bleibt (oder andersherum).