06-04-2024
This commit is contained in:
84
test_sqlite/index.php
Normal file
84
test_sqlite/index.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>How to use Tabledit plugin with jQuery Datatable in PHP Ajax</title>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
||||
<!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /-->
|
||||
<link rel="stylesheet" href="bootstrap.css" />
|
||||
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.css" />
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
|
||||
<script src="https://markcell.github.io/jquery-tabledit/assets/js/tabledit.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h3 align="center">How to use Tabledit plugin with jQuery Datatable in PHP Ajax</h3>
|
||||
<br />
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Sample Data</div>
|
||||
<div class="panel-body">
|
||||
<div class="table-responsive">
|
||||
<table id="sample_data" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Filename</th>
|
||||
<th>Lens</th>
|
||||
<th>Legende</th>
|
||||
<th>Copyright</th>
|
||||
<th>Title</th>
|
||||
<th>Creator</th>
|
||||
<th>Keywords</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script type="text/javascript" language="javascript" >
|
||||
$(document).ready(function(){
|
||||
|
||||
var dataTable = $('#sample_data').DataTable({
|
||||
"processing" : true,
|
||||
"serverSide" : true,
|
||||
"order" : [],
|
||||
"ajax" : {
|
||||
url:"fetch.php",
|
||||
type:"POST"
|
||||
}
|
||||
});
|
||||
|
||||
// id, filename, lens, legende, copyright, title,creator,keywords
|
||||
// [1, 'filename'],
|
||||
|
||||
$('#sample_data').on('draw.dt', function(){
|
||||
$('#sample_data').Tabledit({
|
||||
url:'action.php',
|
||||
dataType:'json',
|
||||
columns:{
|
||||
identifier : [0, 'id'],
|
||||
editable:[[2, 'lens'], [3, 'legende'], [4, 'copyright'], [5, 'title'], [6, 'creator'], [7, 'keywords']]
|
||||
},
|
||||
restoreButton:false,
|
||||
onSuccess:function(data, textStatus, jqXHR)
|
||||
{
|
||||
if(data.action == 'delete')
|
||||
{
|
||||
$('#' + data.id).remove();
|
||||
$('#sample_data').DataTable().ajax.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user