Search
43641 results 7091-7100
Forum
- 8th Mar 2009DataTables + jEditAble - Post from table to server! $100 Donation for AJI wrote a couple tutorials on how to do exactly this, only using inplace.js (almost the same as jeditable): http://naspinski.net/post/Inline-editing-with-DB-write--REAL-AJAX-with-AspNet-Series.aspx - this builds on this tutorial: http://naspinski.net/post/GridView-SortingPaging--REAL-AJAX-with-AspNet-Series.aspx It is using asp.net, but the javascipt is backend indifferent.
- 16th Dec 2021Responsivity only working on one table per pageHi, I have two datatables on one page, each of which is shown in their own container. Then based on which "tab" I click, specific container shows. Now both datatables get initialized correctly, however, the "responsivity" is only working on the first one. EDIT: After trying the obvious columns.adjust API it didn't work for me at start, turns out it was server side caching issue, and It actually works.
- 8th Dec 2021DataTables warning: table id=user_data - Invalid JSON response. For more information about this erroindex.php <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs5/jq-3.6.0/dt-1.11.3/datatables.min.css" /> <title>Jquery DataTable CRUD</title> </head> <body> <div class="container-fluid"> <div class="w-100 d-flex align-item-center justify-content-center"> <div class="col-md-8 p-2"> <table id="user_data" class="table table-striped"> <thead> <tr> <th scope="col">sl No.</th> <th scope="col">Name</th> <th scope="col">Phone</th> <th scope="col">Email</th> <th scope="col">Address</th> <th scope="col">Action</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/v/bs5/jq-3.6.0/dt-1.11.3/datatables.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script> $(document).ready(function () { // var dataTable = $('#datatable').DataTable({ // 'processing': true, // 'serverSide': true, // 'order': [], // 'ajax': { // 'type' : 'POST', // 'url' : 'backend.php', // }, // 'columnDefs': [{ // 'target': [0, 5], // 'orderable': false, // }, ], // }); $.ajax({ type: "POST", url: "backend.php", // data: "data", dataType: "JSON", success: function (data) { $('#user_data').DataTable({ processing: true, serverSide: true, deferRender: true, ordering: false, pagingType: 'full_numbers', 'columnDefs': [{ 'target': [0, 5], 'orderable': false, }, ], }); } }); }); </script> </body> </html> backend.php' ``` <?php $servername = "localhost"; $username = "root"; $password = ""; $db = "jquerydatatable"; // Connection $conn = mysqli_connect($servername,$username, $password, $db); // Check if connection is // Successful or not if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } // echo "all set"; // if(isset($_POST['data'])) // { $query = "SELECT * FROM mytable"; $res = mysqli_query($conn, $query); $count_row = mysqli_num_rows($res); // for search box if(isset($_POST['search']['value'])){ $serachValue = $_POST['search']['value']; $query .= "WHERE name LIKE '%".$serachValue."%'"; $query .= "WHERE phone LIKE '%".$serachValue."%'"; $query .= "WHERE email LIKE '%".$serachValue."%'"; $query .= "WHERE address LIKE '%".$serachValue."%'"; } // for order if(isset($_POST['order'])){ $column = $_POST['order'][0]['column']; $order = $_POST['order'][0]['dir']; $query .= "ORDER BY '".$column."' ".$order; } else{ $query .= "ORDER BY id ASC"; } // pegination // if(isset($_POST["length"]) != -1){ // $query .= "LIMIT ".$_POST['start'].", ".$_POST['length']; // } $data = array(); $res2 = mysqli_query($conn,$query); $filterd_rows = mysqli_num_rows($res2); while($arr = mysqli_fetch_assoc($res2)){ $subArray = array(); $subArray[] = $arr['id']; $subArray[] = $arr['name']; $subArray[] = $arr['phone']; $subArray[] = $arr['email']; $subArray[] = $arr['address']; $subArray[] = '<div class="btn-group" role="group" aria-label="Action Buttons"> <button type="button" class="btn btn-sm btn-success">Edit</button> <button type="button" class="btn btn-sm btn-danger">Delete</button> </div>'; $data[] = $subArray; } $output = array( "draw" => intval(isset($_POST['draw'])), 'recordsTotal' => $count_row, 'recordsFiltered' => $filterd_rows, 'data' => $data, ); // echo json_encode($output); echo json_encode($output); // echo json_encode(array("data" => $output)); // } HERE SHOW LENGTH , START AND DRAW IS UNDEFIND THST IS WHAY I WAS COMMENT IT ... PLEASE CHECK MY CODE AND PLEASE GIVE ME THE REPLY
- 4th Nov 2021Cannot Reinstate Data TableLink to test case: Debugger code (debug.datatables.net): Error messages shown: Description of problem:
- 21st Oct 2021i wanna make table like this , anybody nowLink to test case: Debugger code (debug.datatables.net): Error messages shown: Description of problem:
- 10th Aug 2021DataTables warning: table id=main-data-table - Invalid JSON response.Here is my Controller: ~~public function door_to_door($request_type = ""){ switch($request_type){ case "list" : header("Content-Type: application/json"); $datatable = $this->get_datatable(); $data['data'] = $this->admin->fetch_doortodoor_rate( $datatable['limit'], $datatable['offset'], $datatable['search']['value'] ); $data['draw'] = $datatable['draw']; $data['recordsTotal'] = $this->db->count_all('door_to_door_rates'); $data['recordsFiltered'] = $this->crud->fetch_door_to_door_rate_count($datatable['search']['value']); echo json_encode($data); return; } $data['active']='rate_management'; $data['module_name'] = ''; $data['company_contacts'] = $this->crud->get_company_contacts(); $this->load->view("door_to_door_rates",$data); }~~ And here is my view script: ~~ Pickup Area Drop Off Area Rate </div> </div> </div> </div> </div> <script type='text/javascript'> $("#main-data-table").DataTable({ ajax: { url: ' <?= base_url()?>/admin/door_to_door/list', dataSrc:'data' }, serverSide:true, columns: [ {data: null, render:function(data,type,row){ return row.start_area_name + ", " + row.start_province_name; }}, {data: null, render:function(data,type,row){ return row.end_area_name + ", " + row.end_province_name; }}, {data: "rate"} ] }); </script>~~ How can I fix the error?
- 29th Jul 2021Different Data Sources With Same Structure. One is read by table, other is notLink to test case: https://jsfiddle.net/BeerusDev/okn1e3tf/1/ The test case linked above is a working example with static data. At the end of my footerCallback I have a function updateOutsideCount(). In my static example, I call transformedResults in my flatMap(), and everything works fine, and you can see in the console when you search a previous date (i.e. 7/20/2021) it logs transformedResults in the console. Here is how it looks: { Days: [{ Date: "07/26/2021", Day: "Monday", Location: "Present", Status: "P" }, { Date: "07/27/2021", Day: "Tuesday", Location: "Not Recorded", Status: "NR" }, { Date: "07/28/2021", Day: "Wednesday", Location: "Meeting at Client", Status: "TRV" }, { Date: "07/29/2021", Day: "Thursday", Location: "Meeting at Client", Status: "TRV" }, { Date: "07/30/2021", Day: "Friday", Location: null, Status: null }], Department: "IT", Employee: "Goten Dev" } In my actual example, I cannot use transformedResults because it is not defined, I defined it in my AJAX call and pushed it through as data. When I console.log(data) in my actual dynamic example this is how it is formatted, looks exactly like transformedResults: { "Department": "IT", "Employee": "Sample Dev", "Days": [ { "Day": "Monday", "Date": "7/19/2021", "Status": "P", "Location": "Office" }, { "Day": "Tuesday", "Date": "7/20/2021", "Status": "P", "Location": "Office" }, { "Day": "Wednesday", "Date": "7/21/2021", "Status": "P", "Location": "Office" }, { "Day": "Thursday", "Date": "7/22/2021", "Status": "P", "Location": "Office" }, { "Day": "Friday", "Date": "7/23/2021", "Status": "P", "Location": "Office" } ] } Here is a screenshot How come transformedResults.flatMap() is working, but data.flatMap() is not a function? I can do data.Days.flatMap(), but that leaves dayArray undefined? Here is my JSFiddle for my dynamic version, it includes all of my JS: https://jsfiddle.net/BeerusDev/053zyoL4/8/ The only issue is the ending of my footerCallback! I hope I provided enough test cases/documentation. This has been driving me insane not being able to figure it out.
- 16th Jan 2020it is possible to add a footer to the bottom of the page instead of the table, but only on the lastya he buscado soluciones pero no encuentro requiero ayuda
- 21st Nov 2019Button in table row not showing in responsiveI have a datatable that includes buttons in some of the columns, however when the breakpoint is reached to 'hide' the column where the buttons reside, the button function disappears and it converts to text. Unfortunately I don't have a live example of it and cannot provide for security reasons.
- 6th Nov 2019table having 2 rows based on id.how to cumulative to make single row inatatable library$(document).ready(function () { var empTable = $('#reportTable').dataTable({ "aaSorting": [[0, "asc"]], "iDisplayLength": , "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, ""]], 'bProcessing': true, 'bServerSide': true, "scrollX": true, 'sAjaxSource': 'payment/getAmountData', 'fnServerData': function (sSource, aoData, fnCallback) { $.ajax({ 'dataType': 'json', 'type': 'POST', 'url': sSource, 'data': aoData, 'success': fnCallback }); }, 'fnRowCallback': function (nRow, aData, iDisplayIndex) { var oSettings = empTable.fnSettings(); nRow.id = aData[0]; var nCells = nRow.getElementsByTagName('td'); var basic_pay = reduce(aData[4]); var total = ceiling(parseFloat(aData[4]) + parseFloat(aData[5])); var total_salary = ceiling(parseFloat(total) + parseFloat(aData[6]) + parseFloat(aData[7]) + parseFloat(aData[8]) + parseFloat(aData[9]) + parseFloat(aData[10])); var begin_total = 0; var gpf = 0; var final_total = 0; nCells[6].innerHTML = currencyFormat(basic_pay); nCells[6].innerHTML = currencyFormat(total); nCells[12].innerHTML = currencyFormat(total_salary); return nRow; }, "aoColumns": [ { "bSortable": false }, { "bSortable": false }, { "bSortable": false }, { "bSortable": false }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat }, { "bSortable": false, "mRender": currencyFormat } // , { // "bSortable": false // } ] }); }); try { $this->load->library('datatables'); $query = $this->datatables->select(' employee_info.employee_id as employee_id, employee_info.employee_name, e.designation_name, scale_pay.name, employee_info.basic_pay, employee_info.grade_pay, 0 as total, c.da, c.hra, c.ta, c.da_on_ta, c.fma, 0 as total_salary, 0 as begin_total, 0 as gpf, 0 as final_total ')->from('employee_info') ->join('scale_pay ', 'scale_pay.id = employee_info.scale_of_pay', 'left') ->join('designation e', 'e.designation_id = employee_info.designation_id') ->join('month_pay c', 'c.employee_id = employee_info.employee_id') ->join('monthly_deduction f', 'f.employee_id = employee_info.employee_id AND f.monthyear') // ->group_by('employee_info.employee_id') // ->group_by('employee_info.basic_pay') ->where($where); echo $this->datatables->generate(); } catch (Exception $e) { throw new Exception("Error Processing Request", 1); }