Datatable is working only first page, it doesn't work on other pages. And Cant refresh after deletin

Datatable is working only first page, it doesn't work on other pages. And Cant refresh after deletin

varmanvarman Posts: 3Questions: 3Answers: 0

Im new to datatable-bootstrap. I have edit button and delete button, when i press edit button, it works fine on first page only.From 2nd page it doesn't work. And when I press the delete button, the datatable should refresh. But it doesn't work also. what is the code for refreshing the table after deleting ?

<script>
$(document).ready(function() {
    $('#vehicle-list').dataTable();
    
} );    
</script>


<table class="table table-hover myTable" id="vehicle-list">
        <thead>
            <tr>
                <th>No</th>
                <th>No plate</th>
                <th>Type</th>
                <th>A/C</th>
                <th>Fuel</th>
                <th>License Expire</th>
                <th>Model</th>
                <th>Engine No</th>
                <th>Chassi No</th>
                <th>Owner</th>
                <th>Seats</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <?php
                include 'inc/connection.php';
                
                $que="SELECT * FROM vehicle_register";
                $query_run=mysqli_query($con,$que);
                $no=1;
                
                while($row=mysqli_fetch_array($query_run))
                {               
            ?>
                <tr>
                    <td><?php echo $no++; ?></td>
                    <td><?php echo $row['no_plate']; ?></td>
                    <td><?php echo $row['vehicle_type']; ?></td>
                    <td><?php echo $row['ac_type']; ?></td>
                    <td><?php echo $row['fuel_type']; ?></td>
                    <td><?php echo $row['license_expire']; ?></td>
                    <td><?php echo $row['model'];?></td>
                    <td><?php echo $row['engine_no']; ?></td>
                    <td><?php echo $row['chassi_no']; ?></td>
                    <td><?php echo $row['owner_type'];?></td>
                    <td><?php echo $row['seats'];?></td>
                    <td><div class="btn-group"><a class='Edit btn btn-primary' data-toggle="modal" href="#form_modal" data-target="#myModal" data-Id="<?php echo $row['no_plate'];?>">Edit</a><a class='Delete btn btn-danger' data-toggle="modal" href="#form_modal" data-target="#myModal" data-Id="<?php echo $row['no_plate'];?>">Delete</a></div>
    </td>                        
                    
                </tr>
            <?php
                }
                mysqli_close($con);
            ?>
        </tbody>
    </table>



This discussion has been closed.