Skip to content

Commit

Permalink
fix (multipleInstance): final fixes #53 comboBox with two dropdowns i…
Browse files Browse the repository at this point in the history
…f value present
  • Loading branch information
marko220991 committed Mar 20, 2024
1 parent 4d8cf9e commit 7ed746a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libs/PageForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ $.fn.addInstance = function( addAboveCurInstance ) {

// Global variable.
num_elements++;

// Create the new instance
var $new_div = $wrapper
.find(".multipleTemplateStarter")
Expand Down Expand Up @@ -1513,14 +1513,17 @@ $.fn.initializeJSElements = function( partOfMultiple ) {

this.find('.pfComboBox').not('.multipleTemplateStarter .pfComboBox').each(function(){
var min_width = $(this).data('size');
if (min_width == null) {
return;
}
var input_width = $(this).val().length*11;
var inputType = new pf.ComboBoxInput({});
inputType.apply($(this));
inputType.$element.css("width", input_width > min_width ? input_width : min_width);
inputType.$element.css("min-width", min_width);
inputType.$element.find("a").css("margin-left", "-1px");
$(this).after(inputType.$element);
$(this).remove()
$(this).remove();
});

var tokens = new pf.select2.tokens();
Expand Down Expand Up @@ -1754,6 +1757,10 @@ $(document).ready( function() {

$( 'body' ).initializeJSElements(false);

$('.multipleTemplateInstance').each( function() {
$(this).initializeJSElements(true);
});

$('.multipleTemplateAdder').click( function() {
$(this).addInstance( false );
});
Expand Down

0 comments on commit 7ed746a

Please sign in to comment.