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

Ordering

$
0
0

Hi,

I have a table that shout ordering by country. my Problem is the sorting did not work because I get following json:

{
    "data": [
        {
            "uuid": "9842667f-96c5-454b-aa58-ee689bf5d542",
            "name": "sa",
            "email": "worf@defiant.uss",
            "phone": "+4327 343 43 23 23",
            "website": "http://www.klingon.de",
            "streetAddress": "Kronos 47",
            "streetAddress2": "Moon 13",
            "location": "Kronos",
            "postalCode": "2A45B",
            "state": "Alpha Quadrant",
            "country": {
                "ioc": "USA",
                "iso3166_1_alpha2": "US",
                "iso3166_1_alpha3": "USA",
                "nameEnglish": "United States",
                "nameGerman": "United States of America"
            },
            "DT_RowId": "row_1"
        },
        {
            "uuid": "695463d0-1adf-4a86-9258-c0aac18c3bb5",
            "name": "sdf",
            "email": "troi@enterprise.uss",
            "phone": "+11 111111",
            "website": "http://www.enterprise.com",
            "streetAddress": "Romolus 2x3",
            "streetAddress2": "öäü",
            "location": "Romolus",
            "postalCode": "üöäüää",
            "state": "Delta",
            "country": {
                "ioc": "BEL",
                "iso3166_1_alpha2": "BE",
                "iso3166_1_alpha3": "BEL",
                "nameEnglish": "Belgium",
                "nameGerman": "Belgien"
            },
            "DT_RowId": "row_2"
        },
        {
            "uuid": "2087d7df-a81f-4ffa-ba78-d680580df7f0",
            "name": "Speedfish in the Universe",
            "email": "speedy@speed.com",
            "phone": "+43 664 23 23 23 42",
            "website": "http://www.speed.com",
            "streetAddress": "Hubertusdamm an der Klann 13/3/222",
            "streetAddress2": "",
            "location": "Wien",
            "postalCode": "1231",
            "state": "Wien",
            "country": {
                "ioc": "AUT",
                "iso3166_1_alpha2": "AT",
                "iso3166_1_alpha3": "AUT",
                "nameEnglish": "Austria",
                "nameGerman": "Österreich"
            },
            "DT_RowId": "row_3"
        },
    "draw": "1",
    "recordsTotal": 5,
    "recordsFiltered": 5
}

The Country is send with some additional data.

I have written following js code to show the datatable:

var clist = $('#clublst').DataTable( {
        "ajax": {
            url: 'assets/lib/adm/club_util.php?ct=1',
            type: 'POST'
        },
        "columnDefs": [
            { targets: [ 0, 1, 2, 3, 4, 11 ], visible: true },
            { targets: '_all', visible: false }
        ],
        "columns":[
            { data: "name"},
            { data: "country", width: '5%', render: function(data, type, row){
                var session_lang = '<?php echo $_SESSION["language"] ?>';
                var set_Language = (session_lang == 'de')? data.nameGerman : data.nameEnglish
                return  (data.iso3166_1_alpha2 == '')?
                    '<img title="" src="assets/images/flags/rect/24/em.png" />' :
                    '<img title="' + set_Language + '" src="assets/images/flags/rect/24/' + data.iso3166_1_alpha2 + '.png" />'
            }, className: 'text-center'},
            { data: "email"},
            { data: "phone"},
            { data: "website", render: function(data, type, row){
                return '<a href="' + data + '">' + data + '</a>'
            }},
            { data: "streetAddress"},
            { data: "streetAddress2"},
            { data: "location"},
            { data: "postalCode"},
            { data: "state"},
            { data: "uuid" },
            { data: null, render: function (data, type, row){
                    return '<a href="" class="u-edit btn btn-xs btn-default btn-quick" title="Edit" data-toggle="modal" data-target="#aClub" '
                                + 'data-js-hide-block="successAdmClub;failAdmClub;loadingAdmClub;aClubClose" data-js-show-block="formAdmClub;aClubSave" data-uuid="' + data.uuid +'">'
                                + '<i class="fa fa-pencil" style="padding-right: 0px;"></i></a>'
                }, orderable: false, width: '3%'
            }
        ],
        autoWidth: false,
        select: true,
        initComplete: function () { $('#clublst').removeClass('hidden'); }
    });
});

I know that the sorting did not know with which data the should sort. I have no idea, how can the column define the should sort by ioc code. Have someone a idea?

Andreas


Use search for the total sum

$
0
0

Hello,

I combinded the Footer callback function (https://datatables.net/examples/advanced_init/footer_callback.html) with buttons to search for categories like this:
buttons: [
{
text: 'All',
action: function ( e, dt, node, config ) {
var table = $('#example').DataTable();
table.columns( 1 ).search( "" ).draw();
}
},
{
text: 'Bought',
action: function ( e, dt, node, config ) {
var table = $('#example').DataTable();
table.columns( 1 ).search( "Bought" ).draw();
}
}
]

When I select a category (e.g. Bought, Sold, Observed...) the Footer callback sums the current page and alle values. I am looking for an third sum for the current category or otherwise how could I use the current seach for the sum?

Kind regards

Patrick

Slow calls to fnAddData(it, false) on Microsoft Edge

$
0
0

Hello,

I have a code which add 2000 records using

mytable.fnAddData(list, false);

then mytable.fnDraw

This call takes 700 MS on chrome, however on edge it's like 3000 MS (3s) and the page freezes during this time.

Datatables version is 1.9.3 as i remember, also tried quickly replacing with new one - didn't help.

What can be the issue?

Grouping with Sub-Grouping (Working)

$
0
0

I saw this discussion: https://datatables.net/forums/discussion/30674/grouping-and-sub-grouping-close-but-not-there-yet

I tried to adapt the proposed solution to my data (list of functions that have categories, and only some of those categories have sub-categories).

Their solution worked, but did not allow me to hide the columns, and occasionally groups would have a null sub-group.

I found a way to get this to work using the method in the original datatables example: http://live.datatables.net/poxepule/1/edit

I was unable to add a reply to the other discussion because it was locked so I created a new thread.

If anyone knows a better way to do this, please let me know.

Thanks!

Control column always show

$
0
0

Is it not possible to make the responsive control icon always show no matter what the screen size?

Upload File without form

$
0
0

Hi ,

How can i upload file without field. for example if click button for delete then standalone form open to confirm delete and then delete , can i open similar form for upload file .

Regards.
Sunil

passing parameters to column render function

$
0
0

I want to make a function I can pass to DataTables for rendering columns, mainly so I can make a column a clickable link.

How can I pass not only the function name of the renderer but also a parameter, such as the target url?

I made an example showing how not to do it ;)

http://jsfiddle.net/jasonblewis/u9en604m/

See lines 26-27

tia

Get visible column name on server side

$
0
0

Hi,

I am using datatable in asp. net c#, where am also providing show hide column using colvis. Now i want to save to the visible column name in database as bookmarked. if user login and select his saved bookmark, the page will load with his saved visible column and search filters as they will not want to re-select the choice every time. I need to save other search filter too. i am doing this server side. How can i get datatable visible column in server side.

Please help me out. below is my code for binding datatable.

$(document).ready(function () {
$("#table-listing").dataTable({
"bPaginate": false
"bInfo": false
"bFilter": true,
"order": [],
"ordering": true,
"scrollY": '78vh',
"responsive": true,
"scrollCollapse": true,
"dom": 'Bfrtip',
"bAutoWidth": false,
"buttons": [
{
extend: 'colvis',
collectionLayout: 'fixed two-column'
}
],
});
});


language.loadingRecords not working, why?

Search Boxes reappearing after DataTables Refresh, not being hidden by responsive.

$
0
0

Hello,

I have an interesting issue that I am currently unable to resolve in regards to DataTables and the responsive plugin.

The DataTable setup debug can be found here: https://debug.datatables.net/omufij

It's currently has two header rows, one for searching and one for sorting, and due to space limitations has the responsive put on it and hides a few columns upon load. Which is what I was expecting and wanted.

Now I have a form that allows users to update a record on that datatable and then it goes off and refreshes the DataTable, but it doesn't redraw the search boxes in a responsive way, aka it still shows all the input boxes rather then hiding some of them.

Expected DataTable layout: http://imgur.com/a/qyF20 (This a fresh initial load of the datatable)

What happens after a refresh: http://imgur.com/a/IKk82 (Goes off, regrabs the data, and re-draws the table)

Now i'm not sure what I'm doing wrong, for it to not redraw the responsive stuff, but it fixes it's self upon a Window resize.

Any help would be appreciated.

Editor error after multiple successive saves

$
0
0

I have been using datatables for about a year with great results. The only issue that I have run into is when someone is adding one record after another through editor. For example, they add a new record using editor, then another, then another one right after another. Eventually, the editor throws an error and won't let it save without refreshing the page. Has anyone seen this and can you point me in the direction toward a solution?

Is there a way to Export All while using server side processing?

$
0
0

I am using server side processing for my tables. I have tables that have 60000+ rows with 65+ columns, so using client side is not an option for me. My end users want to pull up the tables and then use the filtering and sorting to narrow down what they are seeing. Then they want to Export All, usually still 30k - 40k rows with the 65+ columns and with the sorting in place too. I have tried a few things that I've found elsewhere and am hoping that you can help. Here's what I've tried so far:

{ extend: 'excel',
    text: 'Export Current Page',
    exportOptions: {
        modifier: {
            page: 'current'
        }
    },
    customize: function (xlsx)
    {
        var sheet = xlsx.xl.worksheets['sheet1.xml'];
        $('row:first c', sheet).attr('s', '7');
    }
}

This does not do what I would like. It exports only the current page (which is why I made the text for it 'Export Current Page')

I've also tried this:

{
    text: 'Export All to Excel',
    action: function (e, dt, button, config)
    {
        dt.one('preXhr', function (e, s, data)
        {
            data.length = -1;
        }).one('draw', function (e, settings, json, xhr)
        {
            var excelButtonConfig = $.fn.DataTable.ext.buttons.excelHtml5;
            var addOptions = { exportOptions: { 'columns': ':all'} };

            $.extend(true, excelButtonConfig, addOptions);
            excelButtonConfig.action(e, dt, button, excelButtonConfig);
        }).draw();
    }
}

This simply sends the whole table to the screen instead of sending it to an excel file. Though it does pull the whole data set.

I'm sure that through the two of these I'm missing something that would allow me to Export the whole data set without sending it to the screen first.

Subtract 2 columns

Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined

$
0
0

Hello
I have a problem in one of my pages, where I get this error in the console_log.
"Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined"

I have other pages that display all the datatable options without problem. But this one.
All pages have the same include files (but for the specific js file).
This is a very simple page, with 2 tabs and small tables. I have been comparing the code line by line with a page where it works, and cannot find any difference.
Could somebody hint me where the problem might be so I can find it ? what gives this error in most cases ?
Thanks for the help
pat

adding facebook comments to datatables

$
0
0

Hi,

I am trying to give a css pop up on every row so that clients can add a 'comment' using facebook. At this point if I comment on row1 then it appears on every other row if I go to that row and click comment which opens a css popup and shows the comments.

I am tyring to follow this http://socialmouths.com/2012/02/16/add-facebook-comments-to-your-blog/

It all works until I add '<div data-href=”<?php the_permalink() ?>” data-num-posts=”10″ data-width=”550″></div>'. Then it breaks.

Has any one succesfully implement social plugins and if yes can you please share? :)

Thanks!

Regards,
Rajesh


editor.autoComplete

how do you solve "Uncaught TypeError: $.fn.dataTable.moment is not a function" exception?

$
0
0

When loading a datatable into a dialog I process initialisation files and scripts using $.getScript(url) and $.globalEval(script).

However, when I add the moment.js code I get the error "Uncaught TypeError: $.fn.dataTable.moment is not a function".

The script is

$.getScript("//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js");
$.getScript("//cdn.datatables.net/plug-ins/1.10.12/sorting/datetime-moment.js");
$.getScript("//cdn.datatables.net/v/bs/dt-1.10.12/b-1.2.2/fc-3.2.2/fh-3.1.2/r-2.1.0/se-1.2.0/datatables.min.js");

$.globalEval(aScript);

aScript is

$.fn.dataTable.moment("DD-MM-YYYY HH:mm");
$("#filelist").DataTable(
{

//various settings

});

If I change the loading order of the files

$.getScript("//cdn.datatables.net/v/bs/dt-1.10.12/b-1.2.2/fc-3.2.2/fh-3.1.2/r-2.1.0/se-1.2.0/datatables.min.js");
$.getScript("//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js");
$.getScript("//cdn.datatables.net/plug-ins/1.10.12/sorting/datetime-moment.js");

$.globalEval(aScript);

I get 2 errors

Uncaught ReferenceError: moment is not defined

and then

Uncaught TypeError: Cannot read property 'moment' of undefined

If I load all the files to the page and call $.fn.dataTable.moment("DD-MM-YYYY HH:mm") in the document load (although at that stage I don't know if I'll need them at that point) it all works.

Any ideas?

Thanks

How do I serialize the data in table that is part of a form?

$
0
0

I have a datatable that is part of a form. The table is loaded via an ajax call and there can be several pages.

I have looked at the forum and while there seems to be legacy methods for serializing data, is there a way to do this using the rows() or datatable()?

Thanks.

Date range filter

$
0
0

Sorry for the recurrent question

I have read evey thing to do that and it does,not work

Can you help

Send another ajax request for child row and mak ethe child row as a table

$
0
0

How to Send another ajax request for child row and mak ethe child row as a table

Exampe : row lost of clients and when clicking on one client

A child table opened under with data from ajax request

Viewing all 81402 articles
Browse latest View live


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