A bit confused on the current release. CDN shows a 1.10.19 release while the Download Builder shows and delivers 1.10.18
Thank you.
A bit confused on the current release. CDN shows a 1.10.19 release while the Download Builder shows and delivers 1.10.18
Thank you.
This plugin is great: https://datatables.net/plug-ins/api/sum().
However, it seems to sum the entire column when I use it this way:
table.column( 2 ).data().sum();
Anyone knows how I can achieve this?
Per the title, the CSS for the Choose File and Clear File buttons are wrong. For example:
<button class="btn btn-default">Choose JPG...</button>
btn-default is not a valid Bootstrap 4 style.
I made it pretty with:
editor.on('open', function () {
$('.upload button').addClass('btn-outline-primary btn-sm');
$('.clearValue button').addClass('btn-outline-danger btn-sm');
});
Hi,
I'm trying to implement the colReorder function along with order and colVis functions.
Problem is that if I move a column, the indexes returned from order or colvis functions is the original one and not the actual one.
For example, consider a table with 3 columns (id 0, 1 and 2), column 0 contains internal data so it's hidden by default and not considered in the colVis columns, I order column 2 and then switch it with column 1:
- before moving column, table.settings().order()
returns [ 2, "asc" ]
- after column has been moved i expect to receive [ 1, "asc" ]
, but I get [ 0, "asc" ]
So, if I save table.settings().order()
's result to the database and then use it back on next table initialization, everything is messed up. I've menaged to solve this replacing the returned index with table.colReorder.transpose(idx)
in a for cycle, but is this really the way to go?
With colVis is even worst and I don't even know how to work around it. In the same scenario as above, if I select from the dropdown menù the column number 2, it remains visible, column 0 becomes visible between column 2 and 1, column 1 remains visible.
I've set up a demo for you: https://jsfiddle.net/0yc8sd1z/. Please, switch the 2 columns and then try to hide the column "Office".
Hi,
I have a table ("subscriptions") with the list of user subscribed to a site; I have attached to this table some columns: the number is dynamic.
The values of this colums ara taken from another table, where I have the id of the columns and the value (and the row id as primary key). So, any cells in the rendered table have a "custom" id, not the row id.
In the php controller, after the main sql to subscriptions table, I have a loop that add a column and for every row it search the correct value in the db: for 3 lines and 2 columns like below, I have the main sql and other 6 query.
How I can set, in the editor, the cell's id so when I edit the cell the controller can edit the correct value?
--------------------------------------------------------------------------
|| Id_row | Username | Col_A | Col_B | ....||
-------------------------------------------------------------------------
|| 1 | Frank | a (cell.id = 1) | b (cell.id = 2) | ...||
|| 2 | Mario | c (cell.id = 3) | d (cell.id = 4) | ...||
|| 3 | Frank | e (cell.id = 5) | e (cell.id = 6) | ...||
-------------------------------------------------------------------------
Thanks!
Roberto
Where is a list of the object attr: Attributes that are applied to the select element before Select2? I don't see this list in the documentation:
https://editor.datatables.net/plug-ins/field-type/editor.select2
Is there a preferred version of select2 to work properly with datatables?
Is there a good working example of select2 init?
I have a field that I need to enter both date and time for. Right now I specify a "date" field type so the jQuery UI datepicker is used, but I would like to use datetimepicker (which is an add-on to datepicker). Is it possible to specify the Javascript program I want to run for "date" field types?
I am using the "Join tables - one-to-many join logic" on "https://editor.datatables.net/examples/advanced/joinArray.html", but I get the following error:
"DataTables warning: table id=mgmt - Join was performed on the field 'id' which was not included in the Editor field list. The join field must be included as a regular field in the Editor instance."
Using the same libraries. Wondering why the example works and mine does not
There is a bug in the ColReorder Extension causing misalignment of the column insert points to their actual location. This causes the pointer (the indicator that shows where a column will be dropped) not to line up with the border between columns when a large number of columns are displayed (from my testing somewhere around 7+). I've created a JS Bin to show the behavior. In the example, the top table is displaying current behavior, the bottom table displays the behavior with my suggested fix. When you reorder the columns to the far right you will notice that the pointer does not line up properly with the column borders in the top table. You can see in the javascript that I have overriden the _fnRegions functions for the second table. Note the line:
//total += $(aoColumns[i].nTh).outerWidth();
total = $(aoColumns[i].nTh).offset().left;
outerWidth() is not accurate enough here as the width is rounded down (or up in some cases) for every column, losing precision on every iteration until it is off by full pixels. Getting the left offset will provide a more accurate location for the pointer.
Hello everyone,
I'm new to DataTables and I love it. I started with a simple table with 6 columns. Depending on the values in column 2 and 3 of a row I would like to highlight cell 4 in the same row. I tried to google this, but the only solution I found was a option for column (cssFormat:mark_votes). I read the Reference on datatables.net but couldn't find this option. I also tested it (try & error), but as aspected it didn't work.
I hope I descriped my problem / feature request clearly. Otherwise please give me a short hint and I will try to do better.
Thanks for any ideas.
Best Regards
Thorsten
I am using Datatables, Yadcf and Select2. I have an Error as soon as I click on any filter using select2. The select2 autocomplete is also not working. The error is. The select2('close') method was called on an element that is not using Select2. Unable to get property 'close' of undefined or null reference. I have placed the select2 cdn above the yadcf cdn. I dont know what the problem. I placed an example here. Watch the console. https://jsfiddle.net/Paul2167/zusvc4ra/
I am using filters that sit outside of the table.
The HTML snippet
<div>
<span id="external_filter_container1">
<!-- leave the wrapper contents empty -->
</span>
</div>
The Datatable Yadcf init
var oTable;
jQuery( document ).ready( function($) {
'use strict';
// start datatable
oTable = $('.mytable2').DataTable( {
pageLength: 10,
searching: true
});
// end datatable
// start yadcf
yadcf.init(oTable,
[
{
column_number : 0,
filter_container_id: 'external_filter_container1',
filter_reset_button_text: false,
select_type: 'select2',
filter_default_label: 'First'
},
{
column_number : 1,
filter_container_id: 'external_filter_container2',
filter_reset_button_text: false,
select_type: 'chosen',
filter_default_label: 'Last'
}
]
);
// end yadcf
}); // end ready function
I have 2 external URL JSON files. The first file has all of the records I need to display on the page for orders, and the second JSON file has the contact info for these orders. Each record in the JSON has a unquie key, which should allow me to combine the results of the query. I have used DataTables before, but only sucussful in displaying one external JSON file at a time. Any help would be greatly appricated.
I have set the width of the columns for my datatable but when I use the print button, the columns were set with auto-width again.
Hello,
Like in my sample : https://jsfiddle.net/SuiteProG/obL647z9/6/ the render function is call many times but work look like a cache is enabled.
Can I disabled cache for each call in render function write in my columns ?
In my sample, my column is hidden at 11:21:00. If show column at 11:22:00, the content of column will be 11:21:00. So I want write 11:22:00, like my render function return when showing column.
Is it possible ?
Thanks,
SuiteProG
Hello,
First I have a dt that is being filled by json from an SP call.
SmixTable = table.DataTable({
ajax: {
url: "service/CallSP.cs/CallsSPMethod",
contentType: 'application/json; charset=utf-8',
data: { xx: mId, xx: sId },
dataType: 'json',
},
columns: [
{ "xx": "xx" },
],
buttons: [
{
extend: 'collection',
text: 'xx'
buttons : [{}]
}
]
})
Just an example of my code. As you see the datatable is calling an SP via the method CallSPMethod. This method will return content for the whole table. I would like to fill my button with data from another SP. Is this doable in a neat way? Or will it end up as a hack?
edit: https://datatables.net/extensions/buttons/examples/initialisation/collections-autoClose.html
Like this I would like to fill the datatable with content from one ajax call and would like to fill the button in the links case "Table Control" with content from another ajax call
Br,
Anton
Hello everyone,
I'm new to datatables and I have been using the 15 day trial to explore the tool's feature sets and so far, I must say I'm very impressed.
I know image files can be uploaded while creating new row data entires - but I have a particularly important use case that I'm working on that requires large data sets (tens of thousands of rows and several tens of columns) to be uploaded at a go through CSV files at the front end by the end users.
Can anyone advise me if datatables natively supports this feature?
Thank you
Hi all!
I try to change the text "No data available in table".
I tried:
$(".dataTables_empty").text("There are currently no xyz available for this.");
and
$(".dataTables_empty").html("There are currently no xyz available for this.");
but no success
best greetings and thank you in advance!
Okay, at this time i have 2K row data or more, i use Datatables because of it's simple but not simple like my mind think.
This is my php code to read data from database as JSON
<?php
require 'db_pdo.php';
header('Content-Type: application/json');
$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, TRUE);
$kabupaten = $dbh->query("select *from provinsi inner join kabupaten on kabupaten.id_prov = provinsi.id_prov");
while($row = $kabupaten->fetch()){
$data_kabupaten[] = $row;
}
print json_encode($data_kabupaten);
and this how i read data from JSOn on DataTables :
$('#example1').DataTable ({
ajax: {
url : "defer_kabupaten.php",
dataSrc : ""
},
columns: [
{
"data": null, "defaultContent": "", "targets": -1
},
{ data: "prov_nama" },
{ data: "kab_nama" },
{
data: "id_kab", "visible": false,
"searchable": false},
{
data: null, className: "center",
defaultContent: '<a href="" class="btn btn-warning editor_edit" target="_blank">Edit</a>'
}, {
data: null, className: "center",
defaultContent: '<a href="" class="btn btn-danger editor_remove" target="_blank">Hapus</a>'
}
],
deferRender: true,
responsive: true,
lengthMenu: [[5,10, 25, 50, -1], [5,10, 25, 50, "All"]]
});
And as you can see there's 2 button, edit and delete. I use this to make the button can read simple string from my table as my id, but when i use .val() it doesn't work.
$('#example1').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
var currentRow = $(this).closest("tr");
var col2 = currentRow.find("td:eq(2)").html();
alert(typeof(col2));
}):
So, how i can delete data from Datatables ?
We have a problem regarding bStateSave cookie. We have used bStateSave=true. The feature is working fine.
It remembers the state even after the user logs out of the application. So the next time when user again log in to the application, the settings are still there.
Is there have any way to clear the setting at the time of logout?
Hello,
As in the main question. Is it possible to influence the number of displayed paginate_button in pagination? For long tables (lets say when I have 13 pages to scroll) it shows up like this: "Previous 1 ... 9 10 11 12 13 Next" and for a table which is narrow horizontally it does not look good moving for half of the panel goes to the second row.
Can I limit it to sth like "Previous 1 ... active ... 13 Last"?
Thank you in advance