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

CSS Bug in Editor Upload Field Using Bootstrap 4

$
0
0

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');
  });

colvisGroup with toggle (Show/Hidde a group of columns)

$
0
0

I would like to use the colvisGroup button but toggle the columns rather than show/hide them (For example I want to show columns 4,5,6 when clicked . Then if it is clicked again it will hide 4,5,6). I do not want two buttons: one for show and other for hide, I would like one button to do both.

I do not want to use columnsToggle button as expand the columns and creates one button for each column and I want ONE button to toggle a group of columns at the same time.

For example, look this fiddle in stead of two buttons to show/hide the three columns I would like one button.

Too many row load in server side process

$
0
0

Dear Allan!
I not use paginate, and the server side load too many row when start ajax.
Can I decrease length parameter when called php?
in php:

   private function LoadData()
    {
....
        if(isset($_REQUEST["start"]) && isset($_REQUEST["length"]) && !isset($_REQUEST["action"]))
        {
            
            $len=$_REQUEST["length"];
....

I have 100 columns and i need read only 50 row each ajax call (50*100 field is 5000 field) , but I not can set loading row column number.

Fixed header/footer not working?

$
0
0

Hello everyone;

I want to add fixed header and footer like this link (https://datatables.net/extensions/fixedheader/examples/options/header_footer.html) . I implement all steps, but header/footer cannot be fixed. Any suggestions?

I added this code

$(document).ready(function() { var table = $('#example').DataTable( { fixedHeader: { header: true, footer: true } } ); } )

I added this script

https://code.jquery.com/jquery-3.3.1.js
https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js
https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css
https://cdn.datatables.net/fixedheader/3.1.5/css/fixedHeader.dataTables.min.css

Initializing Datatable in a Modal after page loads with server side ajax post data

$
0
0

Hi,
Just wondering if there is something obvious I'm missing. I've used datatables all over with ajax data server side processing etc, and I've got a modal opening and then calling initialising code for the datatable, however when I try to access the form data for server side paging in my controller (asp.net core) like so

var draw = Request.Form["draw"].FirstOrDefault();
var start = Request.Form["start"].FirstOrDefault();
var length = Request.Form["length"].FirstOrDefault();

(I've used this when using datatables not loaded in a modal) it says it can't evaluate Form until all threads have run and bombs out with any error message.

I assume its because it loaded after the page load, anyone got any ideas to solve this?

Thanks
Richard

data.items is undefined; can't access its "length" property!

$
0
0

Hello, can anyone to tell me where is my erorr in this cod please.

function loadTable() {

$.ajax({
    url: "/rest/Inventory/List",
    method: "GET",
  dataType: "json",
  success: function(data, items) {

     var dataSet = [];

      for(var i = 0; i < data.items.length; i++) {
            dataSet.push([
                data.items[i].id,
                data.items[i].device,
                data.items[i].type.name,
                data.items[i].additionalInfo,
                data.items[i].serialNumber,
                data.items[i].person.name,
                data.items[i].location.name
            ]);
        }

        $('#data-table').DataTable( {
            data: dataSet,
            columns: [
                { title: "Id" },
                { title: "Device" },
                { title: "Type" },
                { title: "Additional Info" },
                { title: "Serial Number" },
                { title: "Person" },
                { title: "Location" }
            ]
        } );

  }
});

}

Keep in DOM paginated elements

$
0
0

Hi.

During pagination, Datatable remove from DOM rows that are hidded.

For developpement reasons i need to always have in DOM all elements contained by Datatable (input elements in hidded rows for example when i submit a form).

Is there a way to do that ?

Thanks

Using column(x).search(v).draw() doesn't work unless I Destroy() first

$
0
0

As mentioned above, I am attempting to use some Buttons to filter to content. Using a button click, I attempt to filter based on a specific column..

The below works IF I use table.destroy...but doing that causes the table to lose its layout?

 initComplete: function () {
            //Use Buttons to change Region
            $('#table-filters').on('click', function (event) {

                var v = $(event.target).val();
                var i = event.target.id;

                var table = new $.fn.dataTable.Api("#datatable");
                table.destroy();
                table.column(19).search(v).draw();

            });

Can't use sort by column or search in content

$
0
0

Hello !
I'm creating a DataTable in a javascript function and when I do, the "search" filter does not appear and the column's sorting is not working. Actually, it looks like the CSS is not working anymore.

Here's my code :

<html>
<head>
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet"/>
<link href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css" rel="stylesheet"/>
</head>
<body>
    <div id="area-panel-content" class="col-md-12">
        <table id="example" class="display" style="width:100%">
            <thead>
                <tr>
                    <th>Repository</th>
                    <th>Date</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>AAA</td><td>AAA</td><td>AAA</td></tr>
                <tr><td>BBB</td><td>BBB</td><td>BBB</td></tr>
            </tbody>
        </table>
    </div>
    <script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.3.1.js"></script>
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js"></script>
    <script>
    $(document).ready(function() {
        var currentTable = $('#example').DataTable();
        fillDataTable();
    } );
    
    function fillDataTable() {
        var folders = "";
        for(var i = 0; i < 5; i++) {
            folders = folders+
            '<tr><td><i class="fa fa-folder" aria-hidden="true"></i>Event'+i+'</td><td>25/12/2018</td><td></td></tr>';
        }
        var tableStart = '<table id="example" class="display" style="width:100%"><thead><tr><th class="sorting" aria-sort="ascending">Repository</th><th class="sorting" aria-label="Column 2: activate to sort column ascending">Date</th><th>Action</th></tr></thead><tbody>';
        var tableEnd = '</tbody></table>';

        $("#area-panel-content").replaceWith('<div id="area-panel-content" class="col-md-12">'+tableStart+folders+tableEnd+'</div>');
    
    }
</script>
</body>
</html>

If you comment the function fillDataTable(), it's working fine. I need to create a DataTable like I'm trying to do it above snippet.
Could you help me out to understand what I'm doing wrong ? Many thanks.

Apostrophe in saved text input

$
0
0

Using Editor Datatables if I enter:

Testing Apostrophe's out

It is saved as

Testing Apostrophe\'s out

I saw some forum posts about Magic Quotes, but I'm using PHP 7.14 so that should rule that feature out.

Any ideas about this appreicated.

Thanks

Datepicker All Options Available

$
0
0

I would like to set Datepicker options for a date field, are all the jQueryUI Datepicker options available? I am loading the jQueryUI Datepicker, so I assume that is the datepicker the Editor is using. When I set the "showOtherMonths" to true it doesn't seem to have any effect when the calendar shows.

Server side date range php

select2 createTag issue with editor

$
0
0

Trying to get select2 createTag to work per https://select2.org/tagging. I get error at dataTables.editor.js line 5275 because canReturnSubmit not defined for the field.

found https://datatables.net/forums/discussion/comment/140478/#Comment_140478, but not sure the correct setting. In any case the select2 fieldtype plugin should be updated if canReturnSubmit is required

Else dataTables.editor.js should verify function exists before calling it

See https://codepen.io/louking/pen/LMGVJm, and enter some new option into the select search box for col0

.NET Core System.Exception: Unknown database type specified at DataTables.Database.Adapter()

$
0
0

Hello,

I'm trying out .NET Core with DataTables Editor and am having an issue connecting to the database. Indications are there's an issue at DataTables.Database.Adapter() in /home/vagrant/DataTablesSrc/extensions/Editor-NET/DataTables-Editor-Server/Database.cs:line 170.

I don't know how to actually get to that file to see what it says.

I downloaded the demo and that works fine: this error is generating for a project where the .NET Core Editor stuff was acquired into the project via NuGet (Version 1.8.1).

I've modified the launchSetttings.json, program.cs files as per installation instructions at editor.datatables.net/manual/net/core. Again, I have the editor .NET Core demo running fine.

I'm not sure what other information to provide at this point.

Thanks in advance for any insight,
-j

Custom checkbox in grid

$
0
0

Hi guys

Hope you are all fine.

Please help me again. im having difficulty getting the value of the custom checkbox. tried everything.

Data.prop(checked)===true
Or
(Id).is(checked)
Or
(Id).val

Im using label + input + span for the custom checkbox.

Thanks again for your help.


Export csv issue with other language characters utf8

$
0
0

Hi

Good day. Hope you're all great.

Guys please help me. Have problem exporting csv with french accents. I have tried adding below:

extend: 'csvHtml5',
charset: 'utf-8',
bom: true,

Still doesnt work. see below exported file result and the table. thanks hope you can help me. really appreciate.

Fetch value from other field in a render: function

$
0
0

On this page https://dev.biofokus.no/prosjekter/ I have a column that I want to filter. If the value is greater than 0 it prints a PDF icon with a link to the PDF. The problem is that the html is printed but I can not get the other value into the function. Am I doing it wrong or should I be using a "rowcallback" ?

E.g. the row (data:12) shows "3". But I want to link to data[9]. It just shows "undefined". So if the field is greater than 0 the link is always like this: **https://dev.biofokus.no/prosjekter/?q=undefined**.

<td class=" center"><a href="/publikasjoner/?q=undefined" target="_blank" title="Åpne rapport i nytt vindu"><i class="fas fa-file-pdf fa-lg"></i></a></td>

Here is the datatables code:

{ "data": 12,
               "defaultContent": '',
               "className": "center",
               "render": function ( data, type, row, meta ) {
                 if (typeof(data) !== 'undefined' && data > 0)
                    {
                        return '<a href="/publikasjoner/?q='+ data[9] + '" target="_blank" title="Åpne rapport i nytt vindu"><i class="fas fa-file-pdf fa-lg"></i></a>';
                    }
                    }
}

How to Export Grouped rows

$
0
0

I cannot export the grouped rows using button exports. I used my own functionality using basic row grouping code for grouping rows in data tables and when i exported the table using "buttons" the grouped rows are not exported. Also I am using static serial number which is also not exported, instead it is found empty. Is there a way to export the contents which are added later. Any idea would be helpful.
Thanks in advance.

Label in Column

$
0
0

Hello!
I am new using DataTable and I have a small problem.
In a column I must show a label depending on its value.
I managed to show the Label but only the first value

Alta: Yes! It's Blue!
Baja: Er... It should be red...
"aoColumns": [{
"targets": 0,
"searchable": false,
"orderable": false,
"className": "dt-body-center"
{
"data": "movimiento_fecha_hora"
},
{
"data": function(data, dataIndex) {
if (data.prioridad_expediente_id = 1) {
return '<label class="label label-primary">' + data.prioridad_expediente_descripcion;
}
if (data.prioridad_expediente_id = 2) {
return '<label class="label label-success">' + data.prioridad_expediente_descripcion;
}
if (data.prioridad_expediente_id = 3) {
return '<label class="label label-danger">' + data.prioridad_expediente_descripcion;
}
}
}],
And ... how do I show the date in dd/mm/yyyy format? Without the time

Exclude row(s) from sorting

$
0
0

Hi guys,

Just found DataTables and implemented it on a table that is filled with data from Google Drive API. This list includes folders that MUST be at the top of the first page. Is there a way to exclude rows from sorting based on a class or something so they always show up first and are never sorted (the list comes sorted in alphabetical order which makes most sense for folders)

DataTables is doing exactly what it should do and it looks fine, I just need to exclude some rows from sorting, so they are always at the beginning of the list. Ideas?

Best regards,
Arnor Baldvinsson

Viewing all 81388 articles
Browse latest View live


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