resize: function () {
this.element.find('.legendsize').each(function () {
var parent = $(this).closest('.legend');
- var aw = $(parent).innerWidth() - 100;
+ var aw = $(parent).innerWidth() - 160;
$(this).css({width: aw, maxWidth: aw, minWidth: aw});
});
},
},
updateLegends: function () {
+ const sizeLimit = 60;
$('[data-legend]' + this.bmidselector).each(function () {
var item = $(this).closest('.item');
var form = item.find('.subform');
var txt = $(this).data('legend').replace(/\%([a-zA-Z0-9_]+)/gm, function (match, varname) {
-
var input = form.find('[name="' + varname + '"]');
-
if (input.length === 0) {
input = form.find('[name="' + form.data('bmid') + '___' + varname + '"]');
}
- var res = $(input).val();
-
+ // All fields
+ let res = $(input).val();
+ // Select2 fields
+ if ($(input).closest('.form-group').find('.select2-selection__rendered').length > 0) {
+ res = $(input).closest('.form-group').find('.select2-selection__rendered').text();
+ }
+ if (res.length > sizeLimit) {
+ res = res.substring(0, sizeLimit) + '...';
+ }
return res;
});
$(this).html(txt);