如果选中复选框,如何显示数据,例如,如果选中了具有值(CHECK)的复选框,则仅显示列详细信息具有标题的行CHECK如果选中CREDIT复选框,则返回详细信息的行数据cloumn有两个值CHECK和credit。 希望能用ajax来制作它 叶片:
</div><label>CHECK</label>
<input type="checkbox" id="chk-20" >
</div><label>CREDIT</label>
<input type="checkbox" id="chk-21" >
<script type="text/javascript">
$(function() {
$('#users-table').DataTable({
processing: true,
serverSide: true,
ajax: 'get_datatable',
columns : [
{data: 'details', name: 'details'},
{data: 'postingdate', name: 'postingdate'},
{data: 'description', name: 'description'},
{data: 'amount', name: 'amount'},
{data: 'type', name: 'type'},
{data: 'slip', name: 'slip'},
{data: 'vendor_id', name: 'vendor_id'},
{data: 'category_id', name: 'category_id'},
],
pageLength: 10,
});
});
</script>
控制器
public function get_datatable()
{
$users=Checks::select(['details','postingdate','description','amount','type','slip','vendor_id','category_id']);
return Datatables::of($users)->editColumn('postingdate', function ($user)
{
return date('Y/d/m', strtotime($user->postingdate) );
})->make(true);
}
答案 0 :(得分:0)
$(document).on('keydown', ".vendor_name", function(e){
if(e.keyCode == 13){ // continue code