When I delete data from jquery data-table it still showing in grid until refresh

0 votes

I tried that table automatically refresh but it does not until I manually reload the whole page.

When I delete data this exception occur in console on .draw();

Uncaught TypeError: $(...).draw is not a function at sortTableAfterdelete

function ConfirmDelteTraining(id) {

        $.post("/Franchise/deleteTraining", { TrainingId: id }, function (data) {

            if (data) {
                debugger;
                var t = $('#trainingGrid').DataTable();
                t.row($('#trainingGrid').find('[data-id=' + id + ']')).remove().draw();

                //Set order after deleting state
                sortTableAfterdelete();
         }

 function sortTableAfterdelete() {

        if ($("#trainingGrid tbody tr td").length == 1) {

            $('#trainingGrid').DataTable().search(this.value).draw();

        }
    };

Aug 19, 2022 in Web Development by gaurav
• 23,260 points
1,617 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
0 answers
0 votes
0 answers

@edureka! in my nodejs as its i have used it and pug also but my css doesn't worked as while running localhost it doesn't show styling of css

<!DOCTYPE html><html></html><head><style></style>@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap'); *{ margin: 0; box-sizing: border-box; padding: 0; } #navbar{ background-color:black; padding: 18px ...READ MORE

Jun 11, 2020 in Web Development by anonymous
• 120 points
1,147 views
0 votes
1 answer

Using Jquery Ajax to retrieve data from Mysql

Perform a AJAX GET request to get ...READ MORE

answered Jun 23, 2022 in Web Development by rajatha
• 7,680 points
23,214 views
0 votes
1 answer

Loading gif in jQuery ajax call is not showing

Create a div with your image. Make it ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,680 points
1,713 views
0 votes
1 answer
0 votes
1 answer

datatable remove column on export to pdf and excel

When we are using jquery datatable for ...READ MORE

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
4,218 views
0 votes
1 answer

TypeError: $(...).DataTable is not a function

This happened because the jQuery DataTables library ...READ MORE

answered Apr 30, 2022 in Git & GitHub by narikkadan
• 63,600 points
14,012 views
0 votes
0 answers

Get json object values and store as arrays

[ ['david','female','john','e6a33eee180b07e563d74fee8c2c66b8',1,1,'roger63'], ...READ MORE

Nov 16, 2022 in Database by Ashwini
• 5,430 points
1,537 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP