django - Bootstrap - Table Within Modal Within Table -
i'm using django bootstrap , have problem modal window. have table , within have 1 column cell link modal window. modal window should display table relevant cell selected.
the problem i'm trying keep modal div inside of loop because that's how determining row of table has been clicked. i've read little on modals , seen other people have problem when modal div inside table tags, think that's issue might coming from.
at moment, main table displays , modal window opens when click on cell intended. takes information loop properly.
however, when put table within modal div doesn't display in modal window, displays underneath main table whether modal has been activated or not. modal window displays header , footer empty body. if rid of table inside modal , use p's instead works prefer use table.
if move modal div outside of works table in modal window, problem need within loop because that's how know row of table has been clicked.
can tell me if there better way of doing doing, passing variable based on row has been picked if possible, or if there way keep modal div , still display table in modal window?
the html below.
<table class="weekly table-hover main-manager-display" style="text-align: center; width: 100%"> <thead> </thead> <tbody style="color: white"> {% week in team_selection %} <tr> {% item in week|slice:":10" %} <td>{{ item }}</td> {% endfor %} <td><a data-toggle="modal" href="#maxmodal" style="color: white">{{ week.10 }}</a></td> <td>{{ week.11 }}</td> </tr> <div class="modal fade" id="maxmodal" role="dialog"> <div class="modal-dialog"> <div class="modal-content" style="background-color: #c4dfe6"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title" style="text-align: center; color: #1c4d66">week {{ week.0 }} best possible team</h4> </div> <div class="modal-body"> <table class="table modal-table"> <thead> <tr> <th>position</th> <th>player</th> <th>points</th> </tr> </thead> <tbody> <tr> <td>test1</td> <td>test2</td> <td>test3</td> </tr> </tbody> </table> </div> <div class="modal-footer"> <button type="button" class="btn" data-dismiss="modal" style="background-color: #c4dfe6; color: #1c4d66">close</button> </div> </div> </div> </div> {% endfor %} </tbody> </table>
for future reference, got work using code below alternative <table> tag.
<style> .table { display: table; } .row { display: table-row; } .cell { display: table-cell; } </style <div class="modal-body"> <div class="table"> <div class="row"> <div class="cell"></div> </div> </div> </div>
Comments
Post a Comment