Sensing the significance of Industrial Machines in numerous industries,Hongchuang Automation Equipment Co., Ltd has integrated its years of experience and come up with a range of dimensionally accurate Milling and metal Cutting Machines. Being one of the leading Milling machines Suppliers in China, we have truly assimilated in us a philosophy of providing total quality to our valued customers. Recognized for supplying precisely developed Lathe & Milling Machines, we have already become a name to be reckoned in the Engineering Industry. Utilized for shaping metals, our technologically-advanced Heavy Duty Lathe Machine has created a revolution in the industrial sector. Through our unique blend of quality, reasonable price and expedite service we have gained access to major Chinese cities for delivering our products promptly and efficiently.Customized Cv Jont Line Machine
website:http://www.brass-valve-machine.com/
website2:http://www.china-valve-machine.com/
Customized Cv Jont Line Machine
Its possible keep the select when the data comes from ajax?
I need to use the pagination and while keeping the selections that come in an ajax request, Its possible?
Example:
Page one you select two rows, and then you call request ajax, and the page four of datatable you selec other two, and
you would have four rows. If you order the datatable by name you would keep the results
Thanks
How to add additional feature/function in DataTables?
I have a create a basic datatable, now I want to customize it by adding filter in every column. I already got the solution from: https://www.datatables.net/examples/api/multi_filter_select.html
BUT, where I should put the additional code? I have tried copy paste the code in jquery.datatables.js and also try to put in new js file, neither both of them worked.
Please kindly help me...
ajax.reload is lazy-loading and resizing
Hello together,
it's my first time working with DataTables but I really enjoy the functionality of the framework.
While developing i happened to get two behaviours i didn't expect:
Resizing
I have a server-side-processed dataTable on my page which is initialized when the document is ready (jQuery).
Sometimes the width of the table-header-row isn't calculated probably so the visual result looks kinda buggy.
The table body is sized perfectly after loading the data but the header-row is only at minimum width and not as wide as the body.ajax.reload
The API-Method ajax.reload seems to be lazy-loading. It only works for me if i change a property of the API-object via the search method (or any other method) before i call ajax.reload.
Is there anyway to force the ajax reload?
Greetings dvol
How Can I Change Font Size of PDF Message?
Hi,
How can i change the font size of PDF " messageTop" font size and font style(bold)?
{
extend: 'pdfHtml5',
messageTop: 'Report List',
}
Custom column filter with filter icon beside column header text!!!
Hi Team,
I'm wondering if is there anyway to add a filter icon beside column header name, and when user click on it, it should show the filter options like search and strings from the table for that particular column. Please find the attached reference image.
Thanks!
DataTables Inline Editor select does not maintain selected value
Dear,
We are having same problem like the one mentioned in the https://datatables.net/forums/discussion/31210/datatables-inline-editor-select-does-not-select-current-value-or-submit-first-value. Can you please send us the fixed .js files.
Basically select combo doesn't maintain the selected value and instead when we click it for editing combo box always initialized and select first value instead of the selected one.
An early reply will be helpful.
CSS ::before property only working in first column of multi-column colvis buttons in Chrome v63.0.32
I am using Colvis. I have set the collectionLayout property to 'fixed three-column'. I use CSS to put a tick or a cross before my button text, to indicate whether the column is selected or not. Since the lastest version of Chrome has been released, the tick or cross does not show in anything but the first column. It does work in IE11, Edge, Firefox and Chrome v62.0.32.
Here is a screen shot of my problem:
This is the css
/* put a cross to show that a column is not visible */
a.dt-button.buttons-columnVisibility span.glyphicon:before {
content:"\e014";
}
/* put a tick to show that a column is visible */
a.dt-button.buttons-columnVisibility.active:not(.disabled) span.glyphicon:before{
content: "\e013";
}
This is the javascript:
{
extend: 'colvis',
columns: ':not(.excluded-from-colvis)',
className: 'btn btn-primary colvis-button',
collectionLayout: 'fixed three-column',
columnText: function ( dt, idx, title ) {
return '<span class="glyphicon"></span> ' + title;
},
postfixButtons: [{
extend: 'colvisGroup',
text: 'Show all columns',
show: ':not(.excluded-from-colvis)'
}]
}
Datatables column modification after initcomplete
I have a list of projects that the controller send to the view:
[HttpGet]
public ActionResult GetAllProjects(string userid, string stat)
{
return Json(new
{
aaData = Repository.GetAllProjects(userid).Select(x => new String[] {
x.ID,
x.ProjectNumber.ToString(),
x.ProjectTypeText,
x.SelectedProjectType,
x.Priority.ToString(),
x.StatusText,
x.Status,
x.ProjectStateText,
x.ProjectState,
x.CreatedDateForDisplay,
x.ProjectTitle,
x.Description,
x.CreatedBy,
x.AssignedUserName,
x.AssignedUser,
x.BackUpUserName,
x.BackUpUser,
x.Criticality.ToString(),
x.EvaluationDeadlineDateForDisplay,
x.SolutionDeadlineDateForDisplay,
x.NumberofComments.ToString(),
x.Notify.ToString(),
x.ITDRequest.ToString(),
x.NewFunding.ToString()
})
}, JsonRequestBehavior.AllowGet);
}
The problem is that the list of statuses is different for each project type and I am trying to change the dropdown after I initialize the table. I can display ALL statuses with this:
"render": function(data, type, full, meta){
var typestatlist;
var $ddiv = $("<div class='tooltip'><span class='tooltiptext' style='font-size:x-small !important;'>Select Project Status for this project.</span></div>");
var $select = $("<select></select>", { 'class' : 'ctrl-status'});
$select.attr("id", "ddl" + full[0])
$.each(statuslist, function (Value, Text) {
var $opt = $('<option value=' + Text.Value + '>' + Text.Text + '</option>');
if (Text.Value === full[6]){
$opt.attr("selected", "selected");
}
$select.append($opt);
});
$ddiv.append($select);
return $ddiv.prop("outerHTML");
But I am trying to change it based on type in the initcomplete:
var tab = $("#tblProjects").DataTable();
tab.rows().every(function (idx, tbll, rwl){
var dat = this.data();
var c = dat[3];
var rw = this;
var $ddiv = $("<div class='tooltip'><span class='tooltiptext' style='font-size:x-small !important;'>Select Project Type for this project.</span></div>");
var $select = $("<select></select>", { 'class' : 'ctrl-status'});
$.ajax({
type:'GET',
url: '@Url.Action("GetAllProjectStatusPairsByType")',
data: { type : c},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data){
if (data.length === 0){
typestatlist = { "Value" : "NONE", "Text" : "NONE"};
} else {
typestatlist = data;
}
$.each(typestatlist, function (Value, Text) {
var $opt = $('<option value=' + Text.Value + '>' + Text.Text + '</option>');
if (Text.Value === c){
$opt.attr("selected", "selected");
}
$select.append($opt);
});
$ddiv.append($select);
dat[5] = $ddiv;
rw.data(dat);
}
});
});
Set focus to search easily
One thing I noticed recently is that it would be nice if the search-field on many of the Datatables I created could automically get focus on PageLoad. Now there is a lot of JS-Code around on the web t do this - but...
* it would be nice to have this as an optional feature in DT
* the HTML5-approach to this seems to be to set the "autofocus"-attribute on the control - and that calls for Datatables even louder (I suspect it would be need to be set early on).
FileUpload and ServerSide processing incompatible?
hello i was just trying to use editor, on tip from a friend, but i think that i found a critical bug:
https://editor.datatables.net/examples/advanced/upload.html
if you use the file upload feature in combination with server side processing Datatables PHP Server API will still continue to give in the reply json the full list of the "files" table that, and does not limit on the record shown, looking at the future when having like 1000+ rows can result in a lot of unuseful transmitted data on each request.
is there a way to limit the file list to the shown records? am i doing something wrong?
Bug Responsive 2.2.1 bootstrap 4 in Collapse Componet
Responsive-2.2.1
https://getbootstrap.com/docs/4.0/components/collapse/
When entering a table into a collapse, the table is not responsive unless the window is resized manually. (Large and reduce again)
How to multi filter in one run?
Hi Allan
I been having some troubles in filtering on a big table.. after debugging it i found out that my code design was not good, because i used to run an ajax call for each filter param (that the user filled), meaning that if the user filled 3 filters my code will do 3 ajax call.
my code :
$.each(search_array, function(key1, value1) {
table.columns(key1).search(value1).draw();
});
is there a way to send an array to the filtering method?, instead of each time to send the key and value..
or any other way to fix it?
Thanks
how to create report in pdf format
Can any one share me how to print report in pdf format when button click ,mvc view just have single button which shows report ?? i do not want to bind data in view,just want in action method .
@model CallCenterCRM.TBL_CustomerMaster
$(document).ready(function () { $('#example').DataTable({ dom: 'Bfrtip', buttons: [ //'copyHtml5', //'excelHtml5', //'csvHtml5', 'pdfHtml5' ] }); });@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-group">
<div class="col-md-10">
@Html.ActionLink("Show All Customer", "ShowReport", "Customer")
</div>
</div>
}
public ActionResult ShowReport()
{
return View();
}
DataTables Returns No Data Available in Table when its actually there
Sorry Guys I am new to DataTables and have customised the code I got on the internet but I cant seem to be able to show the data. I amtrying to get data from a table tblbooking which has a lot of records. But each time I try to show the page I get the error No Data Available in Table.
I have 2 pages. the bookings page order.php with the following code $(document).ready(function(){
var orderdataTable = $('#order_data').DataTable({
"processing":true,
"serverSide":true,
"order":[],
"ajax":{
url:"order_fetch.php",
type:"POST"
},
<?php
if($_SESSION["type"] == 'master')
{
?>
"columnDefs":[
{
"targets":[4, 5, 6, 7, 8, 9],
"orderable":false,
},
],
<?php
}
else
{
?>
"columnDefs":[
{
"targets":[4, 5, 6, 7, 8],
"orderable":false,
},
],
<?php
}
?>
"pageLength": 25
});
Then the order_fetch.php is as below
//order_fetch.php
include('database_connection.php');
include('function.php');
$query = '';
$output = array();
$query = " SELECT * FROM tblbooking ";
if($_SESSION['type'] == 'user') { $query .= 'WHERE DoneBy = "'.$_SESSION["user_id"].'" AND '; }
if(isset($_POST["search"]["value"])) { $query .= '(PaxName LIKE "%'.$_POST["search"]["value"].'%" '; $query .= 'OR Paxname LIKE "%'.$_POST["search"]["value"].'%" '; $query .= 'OR BookingRef LIKE "%'.$_POST["search"]["value"].'%" '; $query .= 'OR InvoiceNo LIKE "%'.$_POST["search"]["value"].'%" '; $query .= 'OR BookingDate LIKE "%'.$_POST["search"]["value"].'%") '; }
if(isset($_POST["order"])) { $query .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' '; } else { $query .= 'ORDER BY BookingID DESC '; }
if($_POST["length"] != -1) { $query .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length']; } $statement = $connect->prepare($query); $statement->execute(); $result = $statement->fetchAll(); $data = array(); $filtered_rows = $statement->rowCount(); foreach($result as $row) { $payment_status = '';
if($row['IsCashSale']>0)
{
$payment_status = '<span class="label label-primary">Cash</span>';
}
else
{
$payment_status = '<span class="label label-warning">Credit</span>';
}
$status = '';
if($row['Cancelled']<1)
{
$status = '<span class="label label-success">Active</span>';
}
else
{
$status = '<span class="label label-danger">Inactive</span>';
}
$sub_array = array();
$sub_array[] = $row['BookingID'];
$sub_array[] = $row['PaxName'];
$sub_array[] = $row['BookingID'];
$sub_array[] = $payment_status;
$sub_array[] = $status;
$sub_array[] = $row['BookingID'];
if($_SESSION['type'] == 'master')
{
$sub_array[] = get_user_name($connect, $row['user_id']);
}
$sub_array[] = '<a href="view_order.php?pdf=1&order_id='.$row['BookingID'].'" class="btn btn-info btn-xs">View PDF</a>';
$sub_array[] = '<button type="button" name="update" id="'.$row['BookingID'].'" class="btn btn-warning btn-xs update">Update</button>';
$sub_array[] = '<button type="button" name="delete" id="'.$row['BookingID'].'" class="btn btn-danger btn-xs delete" data-status="'.$row["Cancelled"].'">Delete</button>';
$data[] = $sub_array;
}
function get_total_all_records($connect) { $statement = $connect->prepare(" SELECT * FROM tblbooking "); $statement->execute(); return $statement->rowCount(); }
$output = array( "draw" => intval($_POST["draw"]), "recordsTotal" => $filtered_rows, "recordsFiltered" => get_total_all_records($connect), "data" => $data );
echo json_encode($output);
<?php > Please anyone who can check and advise where my error is. I am new to dataTables and struggling for the past 4 days with same issue![](https://www.datatables.net/forums/uploads/editor/rv/t13rhrely2gh.png "") ?>DataTable error
jquery.min.js:4 GET http://localhost/tms/admin/assests/plugins/images/sort_both.png 404 (Not Found)
I Don't want to show "Save Dialogue" box while export excel file.
When user click on download button, excel file should download directly, without showing save dialogue box. How can we implement this?
DataTables presenting with a card view
I have seen lots of discussion on trying to get datatables to present in a "card" or "panel" type view. I see there are lots of workarounds utilizing the various callbacks and events. I believe i have found the simplest method yet.
My method relies solely on CSS. Heres a few screen shots and a link to a sample page.
azguys.com/datatables/index.html
I have tested it out on Chrome and IE, they both seem agreeable to the CSS, no funny quirks. Give it a try and let me know what you think, and if it may have problems of other browsers.
Paging Server Side Processing / XML
Hello there,
I have a problem which I can't figure out.
I'm using datatables server side processing to get data from a postgresql database. It works great but there is a problem with the pagination.
I display 25 row for each page, when i switch from page 1 to 2 there is no problem, but the count of all my data is 50, so I want the pagination to stop at 2 but datatable display page 3/4/5 which are empty.
So here is my question, how can I have the right pagination ?
Here is the code of my datatable creation :
dataTableElement = $('#tablename').DataTable({
"serverSide": true,
"info": false,
"iDisplayLength": 25,
"ajax" : {
"url" : "/",
"type" : "POST",
"data" : {
request : 'request',
element : element,
page : page,
historicSearch : historicSearch,
"source" : 'datatable'
},
"dataSrc" : "objects",
"dataFilter" : XML2JSON
},
"language": {
"lengthMenu": "Afficher _MENU_ éléments par page",
"zeroRecords": "Aucun élément.",
"infoEmpty": "Rien à afficher.",
"search": "Rechercher : ",
"paginate": {
"previous": "Précédent",
"next": "Suivant"
},
},
"columnDefs": [
{"name": "0", "targets": 0},
{"name": "1", "targets":1},
{"name": "2", "targets":2},
{"name": "3", "targets":3},
{"name": "4", "targets":4},
{"name": "5", "targets": 5},
{"name": "6", "targets": 6},
{"name": "7", "targets": 7},
{"name": "8", "targets": 8},
{"name": "9", "targets": 9},
{"name": "10", "targets": 10},
{"name": "11", "targets": 11},
{"name": "12", "targets": 12},
{"name": "13", "targets": 13}
],
conditionalPaging: true,
"columns": [
{data: "0", title: "0"},
{data: "1", title: "1"},
{data: "2", title: "2"},
{data: "3", title: "3"},
{data: "4", title: "4"},
{data: "5", title: "5"},
{data: "6", title: "6"},
{data: "7", title: "7"},
{data: "8", title: "8"},
{data: "9", title: "9"},
{data: "10", title: "10"},
{data: "11", title: "11"},
{data: "12", title: "12"},
{data: "13", title: "13"}
],
"order": [[ order, "asc" ]]
});
I'm using XML to get the data which will be display like that :
<?xml version="1.0" encoding="utf-8"?>
<response>
<header>
<timestamp>2018-01-15 11:35:24</timestamp>
<request>request</request>
<element>element</element>
<template>template</template>
<datetime>15/01/2018 11:35:24</datetime>
<exectime>0.035</exectime>
</header>
<data>
<previousPage>previouspage</previousPage>
<recordsTotal>2</recordsTotal>
<objects pkey="id" total="2">
<object id="1">
<attr name="0">0</attr>
<attr name="1">1</attr>
<attr name="2">2</attr>
<attr name="3">3</attr>
<attr name="4">4</attr>
<attr name="5">5</attr>
<attr name="6">6</attr>
<attr name="7">7</attr>
<attr name="8">8</attr>
<attr name="9">9</attr>
<attr name="10">10</attr>
<attr name="11">11</attr>
<attr name="12">12</attr>
<attr name="13">13</attr>
<etatService>0</etatService>
</object>
<object id="3">
<attr name="0">0</attr>
<attr name="1">1</attr>
<attr name="2">2</attr>
<attr name="3">3</attr>
<attr name="4">4</attr>
<attr name="5">5</attr>
<attr name="6">6</attr>
<attr name="7">7</attr>
<attr name="8">8</attr>
<attr name="9">9</attr>
<attr name="10">10</attr>
<attr name="11">11</attr>
<attr name="12">12</attr>
<attr name="13">13</attr>
<etatService>0</etatService>
</object>
</objects>
</data>
</response>
The XML2JSON function transform XML into JSON, so I can get every parameters I want, like "recordsTotal" which I think is the key of the problem.
Here is the display of JSON I have :
{
"recordsTotal":"2",
"objects":[
{
"0":"0",
"1":"1",
"2":"2",
"3":"3",
"4":"4",
"5":"5",
"6":"6",
"7":"7",
"8":"8",
"9":"9",
"10":"10",
"11":"11",
"12":"12",
"13":"13"
},
{
"0":"0",
"1":"1",
"2":"2",
"3":"3",
"4":"4",
"5":"5",
"6":"6",
"7":"7",
"8":"8",
"9":"9",
"10":"10",
"11":"11",
"12":"12",
"13":"13"
}
]
}
So what can I do to have the right pagination in my page ?
Many regards,
Artens.
Getting column.type via API
I'd like to be able to find the type set via options within the API but can't seem to find a way of retrieving it?