Revision 1c3c31c2
Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
423 | 423 |
} |
424 | 424 |
|
425 | 425 |
sub action_multi_items_update_result { |
426 |
my $max_count = 100;
|
|
426 |
my $max_count = $::form->{limit};
|
|
427 | 427 |
|
428 | 428 |
my $count = $_[0]->multi_items_models->count; |
429 | 429 |
|
430 | 430 |
if ($count == 0) { |
431 | 431 |
my $text = escape($::locale->text('No results.')); |
432 | 432 |
$_[0]->render($text, { layout => 0 }); |
433 |
} elsif ($count > $max_count) { |
|
433 |
} elsif ($max_count && $count > $max_count) {
|
|
434 | 434 |
my $text = escape($::locale->text('Too many results (#1 from #2).', $count, $max_count)); |
435 | 435 |
$_[0]->render($text, { layout => 0 }); |
436 | 436 |
} else { |
SL/Presenter/Part.pm | ||
---|---|---|
256 | 256 |
Or you can even do it the other way round setting C<multiple> to 1 on creation |
257 | 257 |
and open a single selection popup with js. |
258 | 258 |
|
259 |
If C<%params> contains C<multiple_limit> the alternative popup will not |
|
260 |
show any results if there are more than C<multiple_limit> results. A warning |
|
261 |
message is displayed in this case. Set C<multiple_limit> to 0 to disable |
|
262 |
the limitation. The limit defaults to 100. |
|
263 |
|
|
259 | 264 |
Obsolete parts will by default not be displayed for selection. However they are |
260 | 265 |
accepted as default values and can persist during updates. As with other |
261 | 266 |
selectors though, they are not selectable once overridden. |
js/kivi.Part.js | ||
---|---|---|
312 | 312 |
commit_none: function(){ }, |
313 | 313 |
commit_one: function(){ $('#update_button').click(); }, |
314 | 314 |
commit_many: function(){ self.open_dialog(); } |
315 |
} |
|
315 |
}, |
|
316 |
multiple_limit: 100 |
|
316 | 317 |
}, $real.data('part-picker-data'), options); |
317 | 318 |
this.$real = $real; |
318 | 319 |
this.real_id = $real.attr('id'); |
... | ... | |
698 | 699 |
update_results: function() { |
699 | 700 |
var self = this; |
700 | 701 |
var data = $('#multi_items_form').serializeArray(); |
701 |
data.push({ name: 'type', value: self.pp.type }); |
|
702 |
data.push({ name: 'type', value: self.pp.type }); |
|
703 |
data.push({ name: 'limit', value: self.pp.o.multiple_limit }); |
|
702 | 704 |
var ppdata = self.pp.ajax_data(function(){ |
703 | 705 |
var val = $('#multi_items_filter').val(); |
704 | 706 |
return val === undefined ? '' : val |
templates/webpages/part/test_page.html | ||
---|---|---|
50 | 50 |
All parts including customer partnumbers of all customers: <br> |
51 | 51 |
[% P.part.picker('part_id23', undef, with_customer_partnumber=1) %]<br> |
52 | 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) %] |
|
53 |
single select dialog for glass-popup-button; multi select with extra button (and limited to 5 results):<br>
|
|
54 |
[% P.part.picker('part_id31', undef, multiple=0, multiple_limit=5) %]
|
|
55 | 55 |
[% L.button_tag('$("#part_id31").data("part_picker").o.multiple=1; $("#part_id31").data("part_picker").open_dialog()', 'Add multiple items') %]<br> |
56 | 56 |
|
57 | 57 |
<h2>Styling</h2> |
Auch abrufbar als: Unified diff
PartPicker: Mehrfachauswahl: Option um Anzeige-Begrenzung zu setzen
Diese war vorher fest auf 100 eingestellt. 100 bleibt die Voreinstellung.