my $ret =
$self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) .
- $self->input_tag("", delete $params{type}, id => "${id}_type", type => 'hidden') .
- $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params) .
- $self->input_tag("", delete $params{column}, id => "${id}_column", type => 'hidden');
+ join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit)) .
+ $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params);
$self->html_tag('span', $ret, class => 'part_picker');
}
for autocompletion. You may comma separate multiple types as in
C<part,assembly>.
+If C<%params> contains C<unit> only parts with this unit will be used
+for autocompletion. You may comma separate multiple units as in
+C<h,min>.
+
Obsolete parts will by default not displayed for selection. However they are
accepted as default values and can persist during updates. As with other
selectors though, they are not selectable once overridden.
var real_id = $real.attr('id');
var $dummy = $('#' + real_id + '_name');
var $type = $('#' + real_id + '_type');
+ var $unit = $('#' + real_id + '_unit');
var $column = $('#' + real_id + '_column');
var state = STATES.PICKED;
var last_real = $real.val();
current: $real.val(),
};
- var type = $type.val();
- if (type !== '')
- data['filter.type'] = type.split(',');
+ if ($type && $type.val())
+ data['filter.type'] = $type.val().split(',');
+
+ if ($unit && $unit.val())
+ data['filter.unit'] = $unit.val().split(',');
return data;
}
real: function() { return $real },
dummy: function() { return $dummy },
type: function() { return $type },
+ unit: function() { return $unit },
column: function() { return $column },
update_results: update_results,
set_item: set_item,