Selected row remove function is not working if i assign data to data- table at server side.
Selected row remove function is not working if i assign data to data- table at server side.

Below remove functionality is not working if i assign data to data- table at server side( MVC controller file). if assign data at client ens in HTML file it is working fine. Please guide me on this?
table.rows( '.selected' ) .remove().draw();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
With server side processing you will need to remove the rows from your Database. Otherwise on each draw the table is refreshed from your server script/DB and the row appears to return.
Kevin
Got you. Thanks.
I am having a similar issue. Do you still use this code?
columnDefs: [{
targets: -1,
defaultContent: '<button type="button" class="delete_btn" data-id="<?php echo "";?>">Delete</button> <button type="button" class="edit_btn">Edit</button>'
}],
The problem is labeling each delete button with a data-id without using a while loop?
If you want to add an ID to your buttons I think you would be better of using
columns.render
. Something like this example:http://live.datatables.net/qemodapi/1/edit
BTW, this is a different question than the original post.
Kevin
<!DOCTYPE html>
<html>
<head>
<title>New View Data</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.18/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
</head>
<body>
<form class="">
<table id="test" class="table-hover table-bordered" style="width:100%">
<h1 align="center">View DataDetils Of Employees</h1>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Password</th>
<th>CPassword</th>
<th>Language</th>
<th>Role</th>
<th>Salary</th>
<th>Gender</th>
<th>Number</th>
<th>Address</th>
<th>Photo</th>
</body>
$(document).ready(function() { $('#test').DataTable( { 'processing':true, 'serverSide':true, 'ajax':'getdata.php' }); });</html>
=================================================================
<?php
//include_once('db.php');
$db=array(
<?php > ?>'host'=>'localhost',
'user'=>'root',
'pass'=>'',
'db' =>'new_emp_details'
);
How to delete record from database using server side processing datatables