Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepend multiselect breaks when you go onto a second line. #37

Closed
The-CoCo opened this issue Oct 18, 2019 · 2 comments
Closed

Prepend multiselect breaks when you go onto a second line. #37

The-CoCo opened this issue Oct 18, 2019 · 2 comments

Comments

@The-CoCo
Copy link

As seen in the image below when you have a multi select and a prepend, if your selects go onto a second line it causes the entire box to drop onto the next line instead of growing on the same line.

image

<!DOCTYPE html>
<html>
<head>
  <!-- bootstrap -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  <!-- select2 -->
  <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />

  <!-- select2-bootstrap4-theme -->
  <link href="https://raw.githack.com/ttskch/select2-bootstrap4-theme/master/dist/select2-bootstrap4.css" rel="stylesheet"> <!-- for live demo page -->
  <link href="select2-bootstrap4.css" rel="stylesheet"> <!-- for local development env -->
</head>

<body class="pt-5" style="min-height:90vh">

<div class="container">
  <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" target="_blank">@ttskch/select2-bootstrap4-theme</a></h3>
  <hr>

  <form>
    <div class="form-group">
      <label>Example of multiple select</label>
          <div class="input-group">
      <div class="input-group-prepend">
        <span class="input-group-text">Prepend</span>
      </div>
      <select multiple placeholder="Choose anything" data-allow-clear="1">
        <option>1fvfvfvffv</option>
        <option>2</option>
        <option>fvfvfvffvf3</option>
        <option>vfvfvvfvvf4</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
        <option>5vfvfvffvff</option>
      </select>
    </div>
  </div>

  </form>
</div>

<!-- bootstrap -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- select2 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
<script>
<!-- select2-bootstrap4-theme -->
$(function () {
  $('select').each(function () {
    $(this).select2({
      theme: 'bootstrap4',
      width: 'style',
      placeholder: $(this).attr('placeholder'),
      allowClear: Boolean($(this).data('allow-clear')),
    });
  });
});
</script>
</body>
</html>
@ttskch
Copy link
Owner

ttskch commented Apr 24, 2020

You can fix it with following additional css.

.select2-container {
  max-width: 900px; /* for example */
}

image

But this max-width size cannot be determined in this library. So please fix it in your app. Thanks.

@ttskch ttskch closed this as completed Apr 24, 2020
@ttskch
Copy link
Owner

ttskch commented Apr 24, 2020

ping @The-CoCo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants