jquery dialog not working

jquery dialog not working

tonyburrisstonyburriss Posts: 2Questions: 0Answers: 0
edited April 2012 in General
I have a jquery dialog confirm box that works on the initial load of jquery datatables. After using search or pagination, the deleteLink onclick event does not work.

Here is javascript code
[code]

$(document).ready(function () {
$('#dataTable').dataTable({
"aoColumnDefs": [
{ "bSortable": false, "bSearchable": false, "aTargets": [1] }
]
});

//modal popup

$("#dialog-confirm").dialog({
autoOpen: false,
resizable: false,
height: 200,
width: 400,
modal: true,
buttons: {
"Delete": function () {
$(this).dialog("close");
$("form")[0].submit();
},
Cancel: function () {
$(this).dialog("close");
}
}
});

$(".deleteLink").click(function (e) {
e.preventDefault();
$("#dialog-confirm").dialog("open");
});
});

[/code]
And here is html
[code]




@Html.LabelFor(p => Model.FirstOrDefault().PriviledgeName)






@foreach (var item in Model)
{


@Html.DisplayFor(modelItem => item.PriviledgeName)


@Html.ActionLink("Edit", "Edit", new { id = item.PriviledgeId }) |
@Html.ActionLink("Details", "Details", new { id = item.PriviledgeId }) |
@Html.ActionLink("Delete", "DeleteConfirmed", new { id = item.PriviledgeId }, new { @class = "deleteLink" })
@using (Html.BeginForm("DeleteConfirmed", "Priviledge", new { id = item.PriviledgeId })) { }


}



This item will be deleted. Are you sure?


[/code]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Have a look at the top FAQ :-) http://datatables.net/faqs#events .

    Allan
  • tonyburrisstonyburriss Posts: 2Questions: 0Answers: 0
    Thank you very much. That worked.
This discussion has been closed.