lundi 5 février 2018

Tables not showing very well in bootstrap modal

I have a bootstrap modal that pops-up on-click of a button. However as soon as I added a table to this modal to display a list of items, the table shows without the button being clicked. The whole view becomes messed up. How do I solve this?

My View:

<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <table class="table table-bordered">
                                                                            <thead>

                                                                            </thead>
                                                                            <tbody>
                                                                                <?php $contacts = \Vanguard\Libraries\Utilities::getContactPersons($project->id); ?>
                                                                                    @if(isset($contacts))
                                                                                        @foreach($contacts as $contact)
                                                                                            <tr>
                                                                                                <td></td>
                                                                                                <td></td>
                                                                                                <td></td>
                                                                                            </tr>
                                                                                        @endforeach
                                                                                    @endif

                                                                            </tbody>
                                                                        </table>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire