onokumus/metismenu

MVC Bootstrap table next page Delete functionality is not working

anandsutar opened this issue · 0 comments

Hi ,

Currently i am using bootstrap table while display grid on first page edit delete is working fine.but if i navigate to second page nothing happen. Edit working find all pages because i have used below code :
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @Class = "glyphicon glyphicon-pencil btn btn-primary btn-sm" })

Delete

Using delete-prompt class i have called model popup in that yes No button is there after that i am calling deleteConfirmation(Id) method

`$('.delete-confirm').click(function ()
{
deleteConfirmation(Id)

        });

function deleteConfirmation(Id) {

$.ajax({
    /**/
    url: '@Url.Action("DeleteConfirmed", "Users")',
    /**/
    data: { 'Id': Id },
    type: 'POST', //POST if you want to save, GET if you want to fetch data from server
    success: function (data) {
        if (data) {
            //now re-using the boostrap modal popup to show success message.
            //dynamically we will change background colour
            if ($('.modal-header').hasClass('alert-danger')) {
                $('.modal-header').removeClass('alert-danger').addClass('alert-success');
                //hide ok button as it is not necessary
                $('.delete-confirm').css('display', 'none');
                $('.delete-confirm').css('display', 'none');
            }

            $("#checkSucess").show();
            $('.success-message').html('User deleted successfully');
            $("#userNameShow").text('');

            window.location.reload();
        }
    }, error: function (err) {
        if (!$('.modal-header').hasClass('alert-danger')) {
            $('.modal-header').removeClass('alert-success').addClass('alert-danger');
            $('.delete-confirm').css('display', 'none');
        }
        $('.success-message').html(err.statusText);
    }
});

}

`
Delete functionality i have used ajax call. it works on first page but having problem on second page.