doubleclick on row opens a dialog everytime, even if one already present for the same row
doubleclick on row opens a dialog everytime, even if one already present for the same row
Hi Allan,
I have a table wich has rows added dynamically with dynamic ID for each row. on dbl click event for each row, opens a dialog which shows the additonal information for the row. but when I doubl click again on same row withot closing the dialog, it agian opens a new dialog with same ID as earlier. i want to stop that. I should be able to open multiple dialogs for different rows but not for the same row. dialog creation is wrritten on class used for row. here the code below.
//rows are added dynamically to the table
$(document).on("dblclick", ".nonlinktd", function (event) {
//alert("sessionrow dblclick");
event.stopImmediatePropagation();
var sessionRowIndex = $("#researchTable-"+clickCount).dataTable().fnGetPosition($(this).parents('tr')[0]);
var sessionAData = $("#researchTable-"+clickCount).dataTable().fnGetData(sessionRowIndex);
var sessionAdtnlInfoDialog = $('<div id="SessionInfoDialog_'+sessionRowIndex+'-'+clickCount+'"></div>');
sessionAdtnlInfoDialog.dialog({
title : 'Session AdditonalInfo', modal : true, width : 800,height:300,
open: function() {
sessionAdtnlInfoDialog.closest(".ui-dialog")
.find(".ui-dialog-titlebar-close")
.html("<span class='ui-button-icon-primary ui-icon ui-icon-closethick'></span><span class='ui-button-text'>close</span>");
},
close: function(){
sessionAdtnlInfoDialog.dialog('close').remove();
},
buttons : [
{ id : 'SessionInfoCancelButton_'+sessionRowIndex+'-'+clickCount, text : 'Cancel',
click : function() {
sessionAdtnlInfoDialog.dialog('close'); }, disabled : false, 'class':'btn btn-primary'
}
]
}).dialog('open');
var identifiers = '';
var items = sessionAData.additionalSessionInfo.split(',');
for( var i = 0; i < items.length; i++ ) {
var nvpair = items[i];
nvpair= nvpair.replace("[", "");
nvpair= nvpair.replace("]", "");
var nvarr = nvpair.split(':');
for( var j = 0; j < nvarr.length; j=j+2 ) {
identifiers+='<tr><td>'+nvarr[j]+'</td><td>'+nvarr[j+1]+'</td></tr>';
}
}
var sessionAddtionalInfo='';
sessionAddtionalInfo+='<h6 style="font-weight:bold;">Additional Session Details:</h6><br/><table class="hoverTable table table-bordered" id="sesionaddtnlInfo-'+clickCount+'" style="width:500px;"><tr><th>Identifier Name</th><th>Identifier Value</th></tr>'+
identifiers+'</table>';
sessionAdtnlInfoDialog.html(sessionAddtionalInfo);
});
I dont have link for it to share. sorry for that. but pls help me with solving to have only one dialog for same row even if dbl clicked wihtout closing the previous one. Thanks in adavance.