Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all 81390 articles
Browse latest View live

DataTable missing sorting icon

$
0
0

Hello,
Unfortunately, i have tried every single possibility of solution for this problem, including the one described in a discussion in this forum.
The problem is the fact that the sorting icon on my datable doesn't appear. Another problem/inconvenient is the type of icon. Basically are two types, the most standard one and the most awesome, and i want to use the last one mentioned.

I really tried everything. Import of .js and .css, definitions in the php page.

I don't know what to do now.

Thank you,
Best regards,
msvf.


Range search in DataTable for a particular column

$
0
0

Hello,
I have a column known as Days Extracted i need a way where in i can get the Javascript (not the jQuery) code which i can use to achieve this.
I looked at the following example
https://datatables.net/examples/plug-ins/range_filtering.html
I need to do exactly this thing but through a select box and Javascript .
PFA the image.
Here is my code below.

  var columnDays = this.api().column(12);  //12 is the column index for Days Extracted
            $('<select><option value="">--Select Days Extracted--</option><option value="0">0 TO 5</option><option value="6">6 TO 10</option><option value="11">11 TO 15</option><option value="16">16 TO 20</option><option value="21">21 TO 25</option><option value="26">26 TO 30</option></select>')
                .appendTo($('#filterDays'))
                .on('change',function () {
                   var min = parseInt($.fn.dataTable.util.escapeRegex(
                       $(this).val()
                   ));
                   var max = min + 5;
                       if(min == 0){
                           max = 6;
                       }
               columnDays.search().draw(); // i need help here..

How to format data params when using GET with AJAX

$
0
0

I really want to use GET to get the data for my grid but almost very example I find uses POST. Is POST better?

All I want to do is pass in a value from a dropdown that I use to filter the datatable. By default it filters by the first option in the dropdown list, and if I toggle to the second value I want to reload the data with the new filter param. I can get this to work with POST but with GET no matter what is selected in the dropdown, I always get back the default results.

    var table = $("#bannerAds").DataTable({
        ajax: {
            type: "GET",
            asynch: false,
                    cache: false,
            url: "/services/admin/BannerAds.asmx/getListofAds",
            contentType: "application/json; charset=utf-8",
            data: function(d) {
                return JSON.stringify("status: $('#status').val()");
            },
            dataType: "json",
            dataSrc: function (json) {
                return JSON.parse(json.d);
            },
            error: function () {
                alert("Unable to load data.");
            }
        },

How to create function with both RowReorder and Export Buttons

$
0
0

Hello,
I am new to dataTables, i want to implement DataTable with which has Export Buttons, but also responsive Row Reorder. i cant seem to have mix them at the same function,

Please Help,
Hugs

Weird characters in Copy to Clipboard splash page

$
0
0

In the Buttons plugin, the Copy to Clipboard button will put up two different splash pages, depending on the amount of data being copied.

The first splash page looks fine, it will copy the text to clipboard and then tell you how many rows were copied.

The second splash page will come up and ask you to ctrl-c to copy the larger amount of data. The problem is, this splash page has some weird characters. "Press ctrl or <weird characters> + c..."

Here's a screenshot: http://imgur.com/a/qCxt3

I've tested this in the latest Chrome, Firefox on Ubuntu and Edge on Windows 10. I'm not sure if this is a charset issue on my machines, or something else? Is anyone else seeing this issue?

These are my generated includes:

<link rel="stylesheet" type="text/css"
              href="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.13/b-1.2.4/b-html5-1.2.4/b-print-1.2.4/datatables.min.css"/>

        <script type="text/javascript"
                src="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.13/b-1.2.4/b-html5-1.2.4/b-print-1.2.4/datatables.min.js"></script>

Here is my javascript:

$('#datatable').dataTable({
                    "aaSorting": [[0, 'desc']],
                    "aLengthMenu": [[10, 50, 100, 500, -1], [10, 50, 100, 500, "All"]],
                    "iDisplayLength": 500,
                    dom: '<"col-md-2"l><"col-md-offset-5 col-md-3"B>frtip',
                    buttons: [
                        'copy', 'excel', 'csv', 'print'
                    ]
                });

Export column string as date to xlsx

$
0
0

Hello!

I'm using the html5export button to export my datatable data which is supplied via dom to and xslx. This works great except when I open the excel document and try to format the column which contains my dates it does not work. This seems to be because excel thinks the column is a string.

However, when I double click on a cell in the column in excel, the date string goes from left aligned to right aligned (which is why I think excel thinks this column is a string format) and then when I try to format that cell with a date format, everything works fine.

Is there a way to explicitly tell datatables, when exporting data, make sure this column is formatted as a date in the xlsx document?

Thanks!

Draw event firing unexpectedly

$
0
0

What are the actions that fire the "draw" event? We are experiencing a situation where the "draw" event is firing unexpectedly. The particular datatable is inside an iframe as part of a webapp that has other iframes hidden in different non-browser webtabs. Additionally $(document).ready and .load are not being executed when the table is being redrawn unexpectedly.

Are there known issues around the "draw" event firing when an iframe is un-hidden or refocused? The goal is to have the iframe tab act the same way as it would when returning from a different browser tab (i.e. do nothing).

Thank you

Trying to build a plugin to handle recurring dates

$
0
0

I'm attempting to develop a RRule plugin to handle recurring dates.

I have a jquery plugin named "recurrenceinput" that is one possibility but I can't seem to find the path to implement the Editor plugin.

Do you have an example of a Datatables Editor plugin that uses a jquery plugin?

I also have a second path using a fuelux.js function and rrule.js and an html page to perform the same function but have no idea where to start.

Do you have an example of a Datatables Editor plugin that presents a modal html page?

Can I simply use jQuery to catch clicks on the field and write my own function outside Datatables Editor and can I access the Editor fields from that function?

A while ago I ran into a post on the forum where the author was doing what I want but I can't find it. I remember he was going to submit it to Datatables for consideration.

Do you have any idea what that was?

As a way to try to get started I was going to use the datetime.js plugin that used to be included with the examples but its not there now and I seem to have lost my copy.

Could you send me a copy of datetime.js?

Finally, in the an Editor plugin is it possible to access the values of fields other than the one associated with the current plugin invocation?

Any other idea are most welcome.

Regards,
Jim


scrollTo() specific row in the next pagination

$
0
0

i'm already implement the scroller for datatable and want to use scrollTo function
the pagelengthdisplay is 63 and when i do table.row(70).scrollTo(), it can't be done
the function tell that no index was found in the page

when i do table.row(60).scrollTo() it work nicely

how can i make that table.row(70).scrollTo() to work, any solution for this problem
thank you,
edos

can I develop edit option using data tables for more than 100,000 records of data.?

$
0
0

I have 100,000 data to edit. Previously to display the data I have used data tables server side scripting to just display and multi column filtering. Now I want to edit. How can I approach? Could you please suggest me.

How to add sum column like that?

Error to show details

$
0
0

Hello!!

I'm create a Datatable with RowDetails

Radomly I recive this error:

Uncaught TypeError: Cannot read property '_detailsShow' of undefined
at u.<anonymous> (datatables.min.js:132)
at Function.isShown (datatables.min.js:114)
at HTMLTableCellElement.<anonymous> (monitoralertas.aspx:335)
at HTMLTableElement.dispatch (jquery-1.10.2.min.js:5)
at HTMLTableElement.v.handle (jquery-1.10.2.min.js:5)

This error appears when I click the button (+) on my Grid

Steps:
1) I have a filter section, when I push the button Search this button call to the function Buscar(). I use the filter section to launch the ajax Rq with parameters

..
function Buscar() {
document.getElementById("Datos").style.display = ""; //Poner el stulo del DIV
$('#KPIAlertas').DataTable().clear()
$('#KPIAlertas').DataTable().destroy()
$.fn.dataTable.moment('DD/MM/YYYY H:mm:ss');
var table = $('#KPIAlertas').DataTable({
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'print'
],
"ajax":
{
"url": "./ajax/alertas.ashx",
"type": 'POST',
"data": { "op": "GetAlertas", "a_codi": ObtenerFiltroCliente()}
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "Cliente" },
{ "data": "Alerta" },
{ "data": "Fecha" },
{ "data": "ValorTotal", "width": "10", "className": "dt-body-center" },
{ "data": "ValorRegistrado", "width": "10", "className": "dt-body-center" },
{ "data": "Valor", "width": "10", "className": "dt-body-center" },
{ "data": "ActualKPI", "width": "10", "className": "dt-body-center" },
{
"data": function (data, type, row, meta) { if (data.FechaRevisada == "") return false; else return true; }, "width": "10", "className": "dt-body-center",
"render": function (data, type, row, meta) {
if (row.FechaRevisada == "") {
return "<img id=IRes_" + row.id_ale + " src='./img/PRevisada.png' onclick='VerificarAlerta(" + row.id_ale + ",1)' />";
}
else {
return "<img id=IRes_" + row.id_ale + " Title='" + row.FechaRevisada + "'src='./img/Revisada.png' onclick='VerificarAlerta(" + row.id_ale + ",0)'/>"
}
}
}
],
"order": [[1, 'asc']],
"pageLength": 25,
"language": {
"url": "./lang/datatable.json",
buttons: {
copy: 'Copiar',
copyTitle: 'Copiado al portapapeles',
copySuccess: {
_: '%d lineas copiadas',
1: '1 línea copiada'
},
print: 'Imprimir'
}
}
});
// Add event listener for opening and closing details
$('#KPIAlertas').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row(tr);
if (row.child.isShown()) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
//var childrenHtml = ObtenerHTML(row.data());
ObtenerHTML(row.child, row.data())
// row.child(childrenHtml).show();
tr.addClass('shown');
}
});

    }

...

Can you help me?

How to update 2 columns with single post at the same time?

$
0
0

`$username = $_POST['username_reg'];
$password_reg=$_POST['password_reg'];
$password = md5($password_reg);
$user_reg_date = date("Y-m-d", time());

    $user_insert= $db->prepare("INSERT INTO users (username,password_tr,password,user_reg_date) VALUES (?,?,?,?)");
    $insert = $user_insert->execute(array($username,$password_tr,$password,$user_reg_date));
    $err = $user_insert->errorInfo();
    if (empty($err[2])) {
        echo 1;
    } else {

        echo "Error!";
    }`

How to update 2 columns with single post at the same time?

Inline editor and submitting all cell data at once, instead of submitting individual cell changes

$
0
0

When using inline editor to edit the cells of a DataTable, the default behavior is to submit the changes to the server when the cell is blurred. This results in a separate AJAX call for each cell edit. What I would like is to use a button to submit ALL changes at once after the user is done editing the table, instead of individual cell submissions. Anyone know how to do this?

Editor type "datetime" exits as soon as a day is selected withou allowing time to be selected

$
0
0

I am using the "datetime" type for a field in the Editor.

All seems to work well except that:

  1. as soon as I select a date in the calendar portion of the widget the widget closes without allowing me to select a time

  2. if I select a time first (bad human factors as it is at the bottom of the widget) then I can move up to the calendar and select a date.

It would seem that I should be able to select both date and time and when the cursor moves outside the widget it should close or there should be OK/Cancel buttons in the widget.

Am I missing something?

Regards,
Jim


Server side pagination using limit 10 or 25

$
0
0

How to add Server Side Pagination in this function, using per page limit 10 or 25

$('#example1').DataTable({
"columnDefs": [
{ "visible": false, "targets": 1 }
],
"order": [[ 0, 'asc' ]],
"displayLength": 10,
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;

            api.column(1, {page:'current'} ).data().each( function ( group, i ) {
                if ( last !== group ) {
                    $(rows).eq( i ).before(
                        '<tr style="background-color:    #e5e7e9  ; color:black;font-weight:bold "><td colspan="6">'+group+'</td></tr>'
                    );
                    last = group;
                }
            });
        }
    });

DataTable missing sorting icon

$
0
0

Hello,
Unfortunately, i have tried every single possibility of solution for this problem, including the one described in a discussion in this forum.
The problem is the fact that the sorting icon on my datable doesn't appear. Another problem/inconvenient is the type of icon. Basically are two types, the most standard one and the most awesome, and i want to use the last one mentioned.

I really tried everything. Import of .js and .css, definitions in the php page.

I don't know what to do now.

Thank you,
Best regards,
msvf.

Setup Scroller

$
0
0

Im using current 1.10.13 of datatables.js and current 1.4.2 of scroller.js and trying to do Server side processing of data.
Unfortunatelly data.length is always ajax requested as value of "-1" which doesn't make much sense to me :-(

This is my Js:

$(document).ready(function() {
$('#dataTable').DataTable( {
serverSide: true,
ordering: false,
searching: false,
ajax: {
url: 'getResults.json',
type: 'post',
data: {
reportName: reportName
},
error: function(){
console.log('error');
}
},
scrollY: 600,
scroller: {
loadingIndicator: true
}
} );
} );

Thanks for any help oder hints!
hamipl from tohatec

fnCreatedRow how to sum each row?

$
0
0

fnCreatedRow how to sum each row

$('#example').dataTable( {

"fnCreatedRow": function( nRow, aaData, iStart, iEnd, aiDisplay ,iDataIndex ) {


  var iRowTotal = 0;



  $('td:eq(9)', nRow).html(iRowTotal);

},

How to create row Vertical sum?

$
0
0

Example :smiley:
value | Sum
1 | 1
2 | 3
3 | 6
4 | 10

Viewing all 81390 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>