Dialog box et dynamic table
Bonjour tout le monde,
J'ai un tableau dynamique contenant plusieurs lignes.Pour chaque ligne , il y a un lien (image) permettant d'afficher un dialog box pour faire des modifications.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <a class="openmodalbox" >
img src="../images/consulter.png" width="30" height="30" title="Display information" />
<span class="modalboxContent" >
<table width="400" style="word-wrap:break-word;">
<tr>
<td colspan="2" align="center"><h2>Personal Information</h2></td>
</tr>
<tr>
<td width="138" class="infosemp" >Name</td>
<td width="260" class="infosemp2"><?php echo $row_rsAllEmp['EMPLOYEE_NAME']; ?></td>
</tr>
<tr>
<td class="infosemp">Surname</td>
<td class="infosemp2"><?php echo $row_rsAllEmp['EMPLOYEE_SURNAME']; ?></td>
</tr>
<tr>
<td class="infosemp">Phone</td>
<td class="infosemp2"><?php echo $row_rsAllEmp['EMPLOYEE_PHONE']; ?></td>
</tr>
</table>
</span>
</a> |
Voici le script utilisé pour afficher les dialog box :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| $(function() {
$('.openmodalbox').click(function() {
$('.modalboxContent').dialog({
width: 'auto',
height:'auto',
resizable: false,
show: 'highlight',
hide: 'highlight',
overlay: { opacity: 0.5, background: 'black'},
open: function() {
$('#myDate').datepicker({title:''}).blur();
},
close: function() {
$('#myDate').datepicker('destroy');
},
});
});
});
$(document).mousedown(function(e) {
var clicked = $(e.target); // get the element clicked
if (clicked.is('.modalboxContent') || clicked.is('.ui.dialog-titlebar')|| clicked.is('.ui-widget-header')|| clicked.parents().is('#ui-datepicker-div')) {
return; // click happened within the dialog, do nothing here
} else { // click was outside the dialog, so close it
$('.modalboxContent').dialog("close");
}
}); |
Mon problème est le suivant :
Quand je clique sur le lien pour faire des modification à une seul enregistrement, tous les dialog boxes s'ouvrent en meme temps (pour tous les enregistrements) !!!