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

createdCell doesn't fire when row data changes

$
0
0

TL;DR: The column.createdCell callback doesn't fire if I manually change row data, or call invalidate(), I feel like it should, but if not, is there a way I can prevent that cell from being re-rendered when row data changes, or is it possible to do DOM manipulation from the column.render callback, somehow?.

I've got a server-side datable setup as part os a custom JQuery widget, as follows: https://pastebin.com/ixEA5mkp

The key here is I've got a couple of columns that aren't displaying data, they're displaying buttons for the user. To accomplish this, I'm using the column.createdCell callback for the column to format the buttons, and attach event handlers. One of the buttons pulls up a dialog to allow the user to edit the row data, which will fire off an AJAX request to update the backing record. What I'd like to do is not have to refresh the whole table page from the backend, when I can just update the row by hand. However, when I update the row data, either via row.data() or by editing the data object and calling row.invalidate(), column.render fires, which wipes the contents of the cells, and the column.createdCell callback doesn't fire, so I don't get the chance to re-build them.

In my mind, since the createdCell callback receives cellData and rowData as parameters, that implies that if those change, the callback should re-fire, despite its name. I can't use the column.render callback, as far as I'm aware, because the DOM for the cell hasn't been built yet, therefore I have nothing to attach event handlers to. I can also just re-query the whole table page, if I really have to. I was just hoping there'd be an easier way.


Disable chrome's 'Page Unresponsive' message loading datatable through ajax

$
0
0

Hello all,

I am using ajax to load a large dataset into datatables 1.10.18. This is the call:

var table = $('#report').DataTable({
'sDom': 'Rlfrtip',
'orderCellsTop': true,
'fixedHeader': true,
'data': json.data,
"initComplete":function( settings, json){
$('#report_wrapper').addClass("PMCreportbox");
}
});

Everything works just fine, but when loading a very large table chrome keep's popping up with it's stupid 'page unresponsive' message. I know it is unresponsive--the user chose a large dataset and it is loading.

I don't need to change any processing...the user is OK with waiting until datatables is done loading. I would just like to get rid of the stupid messagebox.

Has anyone found a way to satisfy chrome so that it will stop printing this annoying message?

row.child Css Issue

$
0
0

For some reason when using child rows, the CSS for the parent row is not passed to the child row.

From what I can see, the row.child creates a td with a colspan, so if I had 13 columns in the parent row the td has a colspan of 13. So if I use the class table table-striped table-bordered to style the main datatable, the parent row has the correct styling yet the child does not.

Due to each td having a padding of 8px the introduced td with colspan introduces 8px around the HTML within the child row, borders are removed and alignment is immediately thrown out, so if I have the same 13 columns structure in the child row, columns no longer align.

Any thoughts?

Please see my sample below:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <div id="content">
        <div class="container">
            <div class="col-lg-12">
                <table class="table table-striped table-bordered" id="Archive">
                    <thead>
                        <tr>
                            <th></th>
                            <th>Id</th>
                            <th>Forename</th>
                            <th>Surname</th>
                            <th>Date</th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tr>
                        <td class="icons"><i class="fi-list btnArchiveHistory" style="cursor: pointer; font-size: 26px;"></i></td>
                        <td>2</td>
                        <td>Sam</td>
                        <td>Smith</td>
                        <td>19/08/2019</td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                        <td class="icons"></td>
                    </tr>

                </table>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    $(document).ready(function () {
    var table = $("#Archive").DataTable({
        "responsive": true,
        "paging": "full",
        "deferRender": true,
        "iDisplayLength": 10,
        "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        "columnDefs": [{ type: "date-euro", targets: 3 }],
        "aoColumns": [
            { "bSortable": false, "bSearchable": false },
            { "bSortable": true, "bSearchable": true },
            { "bSortable": true, "bSearchable": true },
            { "bSortable": true, "bSearchable": true },
            { "bSortable": true, "bSearchable": true },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false },
            { "bSortable": false, "bSearchable": false }
        ],
        "order": [[1, "desc"]]
    });

    $("#Archive").on("click", ".btnArchiveHistory", function () {
        var thisClass = $(this).attr("class");

        if (thisClass.indexOf("fi-minus") >= 0) {
            $(this).removeClass("fi-minus");

            $(this).addClass("fi-list");
        } else {
            $(this).removeClass("fi-list");

            $(this).addClass("fi-minus");
        }

        var tr = $(this).closest("tr");

        var row = table.row(tr);

        if (row.child.isShown()) {
            row.child.hide();

            tr.removeClass("shown");
        } else {
            $.get("/ArchiveHistory?id=" + $(this).attr("rel"), function (html) {
                row.child(html).show();
                

                tr.addClass("shown");
            });
        }
    });
});
</script>

Child Row HTML sample provided by ArchiveHistory

<tr>
    <td class="icons"></td>
    <td>1</td>
    <td>Postman</td>
    <td>Pat</td>
    <td>18/08/2019</td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
    <td class="icons"></td>
</tr>
        <td class="icons"></td>
        <td class="icons"></td>
        <td class="icons"></td>
        <td class="icons"></td>
        <td class="icons"></td>
        <td class="icons"></td>
    </tr>

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Editor form from CSV-Importer invisible with bootstrap3

$
0
0

Hi,
i tried to integrate the CSV import function in my datatable but without success.
It is possible to upload files, but the following screen (Map CSV fields) will not appear. Or is behind another layer.
Maybe someone can help me?

You find my sourcecode here: 45.82.120.50/datatables_beta/

How to over write the paging size for datatable with rowsGroup?

ASPX.NET How to get table to update after CREATE

$
0
0

My software successfully creates a new user on the server via the Editor. It successfully sends the new user to my aspx.net c# webmethod. So good so far.

The webmethod returns a json string with the data sent. I want to update the table, adding the new user. From my reading, it seems like I have to do this in the postSubmit() event. Several questions:

  1. The postSubmit() event has 4 parameters (e, json, data, action). It's my understanding that the json parameter contains the json string returned from my webmethod. Is this Correct?
  2. What is the next step: Do I JSON.parse(json)? If so, where do I put the object?
  3. What is in the data parameter?

Display object with array inside

$
0
0

I have the follow JSON response

{draw: 1, recordsTotal: 17, recordsFiltered: 17,…}
data: [{appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…},…]
0: {appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…}
1: {appName: "SharePoint (ARD)",…}
2: {appName: "SharePoint (ARD)",…}
appName: "SharePoint (ARD) "
contactsRoles: [{key: "N1", value: "SpOwner1"}, {key: "N2", value: "SpOwner1"},…]
ministry: "Ministry"
serversUrls: {S1: ["URL"], S2: ["URL"]}
S1: ["URL"]
S2: ["URL"]
zone: "ZONE"
draw: 1
recordsFiltered: 17
recordsTotal: 17

I am trying to display the serversUrls portion but am running into issues.

Jquery Code

<script type="text/javascript" >
         $('#result').DataTable({
            "serverSide":true,
            "filter": false,
            "orderMulti": false,
            "pageLength": 50,     //Set default page length to 50
            "targets": 'no-sort', //Removes the sorting arrows
            "bSort":false,        //Removes the sorting arrows
            "ajax": "DetailedSearch?handler=ServerSideDataTable",
            "columns":[
                {"data": "location","title":"location"},
                {"data": "serversUrls", "sortable": "false","title":"Servers",
                 "render": function(data,type,row){
                     return data;
                 }
                }
            ],
             rowGroup:{
                dataSrc:'appName'
            },

        });
</script>

If i display the data by using only {"data": "serversUrls", "sortable": "false","title":"Servers"} i get [object Object] as an output

Ive tried using the render function function that returns data, and im met with the same result.

How can i display this type? Im sending a Dictionary<string,List<string>> to the front-end

Unclickable Table Data in Mobile View

$
0
0

Hello there
The table system Datatables.net offers is truly excellent. But I have a problem with the mobile view. For this, I will make a presentation as a picture and video. The problem is:
When you click to open the table in mobile view, when you touch anywhere while browsing the table data, my table closes automatically and this is really annoying. I can't use the table's search and page skip features because there are no clicks. Please help me.

Detailed examination can be made from the links below. Please note that there may be errors in translation.

http://prntscr.com/ourfnl ->http://prntscr.com/ourgi0 -> http://prntscr.com/ouris5
Video: https://streamable.com/07xhr


How to display data of C# type Dictionary

$
0
0

I have a sample response from a webservice call that looks like:

{draw: 1, recordsTotal: 17, recordsFiltered: 17,…}
data: [{appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…},…]
0: {appName: "Sustainable Resource Development - Home Page & Forest Protection Site",…}
1: {appName: "SharePoint (ARD)",…}
2: {appName: "SharePoint (ARD)",…}
appName: "SharePoint (ARD) "
contactsRoles: [{key: "N1", value: "SpOwner1"}, {key: "N2", value: "SpOwner1"},…]
ministry: "Ministry"
serversUrls: {S1: ["URL"], S2: ["URL"]}
S1: ["URL"]
S2: ["URL"]
zone: "ZONE"
draw: 1
recordsFiltered: 17
recordsTotal: 17

I am trying to display the serversUrls portion but am running into issues. If i display the data by using only {"data": "serversUrls", "sortable": "false","title":"Servers"} i get [object Object] as an output. I have tried using the render function function that returns data, and I am met with the same result. How can i display this type? Iam sending a Dictionary<string,List<string>> to the front-end via C#

How does Editor recognise that Moment.JS is loaded for formatting dates?

$
0
0

Hi,

Am trying to follow the straightforward example at https://editor.datatables.net/examples/dates/formatting.html in order to format some dates returned in YYYY-MM-DD format into something more user friendly.

Moment.JS is being loaded on the page prior to any of the datatables files being loaded, however I still get "Uncaught Editor datetime: Without momentjs only the format 'YYYY-MM-DD' can be used" in the console window when I try to alter the format.

I'm using Require.JS to AMD load moment - it's used thorughout the rest of my stack in a similar way. For me to create a test harness illustrating the problem will be very time consuming, so I'm wondering if by asking the question a different way we'll be able to short-circuit the analysis. How does the Editor library determine whether moment.js is loaded? Maybe I can expose the moment library to Editor somehow?

Cheers,
Rick

New Edit Delete Buttons

$
0
0

hello,

so i am a little new to programming and very new to Datatables, i am creating an app that has multiple tables on one page.
i have run into a dead end on getting the "New, Edit and Delete" buttons to show up for each table.

If possible i would also like to have a "add new row" for some of the entries as some of the records will have more then one data set, again if at all possible.

i apologize for my new-ness to all of this, infact this is the first time i have ever asked a forum a coding question.

please excuse the messy code, like i said i am pretty new. any help is greatly appreciated.

<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="manifest" href="site.webmanifest">
        <link rel="apple-touch-icon" href="icon.png">
        <!-- Place favicon.ico in the root directory -->

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">
         <script src="js/vendor/modernizr-3.5.0.min.js"></script>
        <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
        <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
        <script src="js/plugins.js"></script>
        <script src="js/main.js"></script>

        <!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
        <script>
            window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
            ga('create','UA-XXXXX-Y','auto');ga('send','pageview')
        </script>
        <script src="https://www.google-analytics.com/analytics.js" async defer></script>
        <link rel="stylesheet" type="text/css" href="C:\Users\jesse\Downloads\DataTables\Buttons-1.5.6\css\buttons.bootstrap.css">
        <script type="text/javascript" src="C:\Users\jesse\Downloads\DataTables\Buttons-1.5.6\js\buttons.bootstrap.js"></script>

    </body>
    </head>
    <body>
        <!--[if lte IE 9]>
            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
        <![endif]-->

        <!-- Add your site or application content here -->



<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <title>DataTables Editor - Cowpedia</title>

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fh-3.1.4/kt-2.5.0/r-2.2.2/rr-1.2.4/sc-2.0.0/sl-1.3.0/datatables.min.css">
    <link rel="stylesheet" type="text/css" href="css/generator-base.css">
    <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fh-3.1.4/kt-2.5.0/r-2.2.2/rr-1.2.4/sc-2.0.0/sl-1.3.0/datatables.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>





</head>
<body class="dataTables">
    <div class="container">
$(document).ready(function() { $('table.display').DataTable(); } );

$('#mytable').DataTable( { ajax: '/api/staff', dom: 'Bfrtip', table: 'Cowpedia1' columns: [ { data: 'first_name' }, { data: 'last_name' }, // etc ], select: true, buttons: [ { extend: 'create', editor: editor }, { extend: 'edit', editor: editor }, { extend: 'remove', editor: editor } ] } );
$('#mytable').DataTable( { ajax: '/api/staff', dom: 'Bfrtip', table: 'Cowpedia2' columns: [ { data: 'first_name' }, { data: 'last_name' }, // etc ], select: true, buttons: [ { extend: 'create', editor: editor }, { extend: 'edit', editor: editor }, { extend: 'remove', editor: editor } ] } );

$('#mytable').DataTable( { ajax: '/api/staff', dom: 'Bfrtip', table: 'Cowpedia3' columns: [ { data: 'first_name' }, { data: 'last_name' }, // etc ], select: true, buttons: [ { extend: 'create', editor: editor }, { extend: 'edit', editor: editor }, { extend: 'remove', editor: editor } ] } );

<br>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia1" width="100%">

            <thead>
                <tr>
                    <th>Name/ID</th>
                    <th>Date</th>
                    <th>Sire</th>
                    <th>Dame</th>
                    <th>MGD</th>
                    <th>Birthdate</th>
                    <th>Born Organic</th>
                    <th>Breed</th>
                    <th>DHIA Tag</th>
                    <th>Notes</th>
                </tr>
            </thead>
        </table>

    </div>
</body>


<br>
<br>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />


    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.css">
    <link rel="stylesheet" type="text/css" href="css/generator-base.css">
    <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>

</head>
<body class="dataTables">
    <div class="container">

<br>
<br>
<br>        

        <table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia2" width="100%">
            <thead>
                <tr>
                    <th>Date</th>
                    <th>Breeding Record</th>
                    <th>Calving Record</th>
                </tr>
            </thead>
        </table>

    </div>
</body>


<br>
<br>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />



    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.css">
    <link rel="stylesheet" type="text/css" href="css/generator-base.css">
    <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>
</head>
<body class="dataTables">
    <div class="container">

<br>
<br>
<br>

        <table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia3" width="100%">
            <thead>
                <tr>
                    <th>Date</th>
                    <th>Condition</th>
                    <th>Treatment</th>
                </tr>
            </thead>
        </table>

    </div>
</body>

</html>

How can I add a description on the side of a dropdown/select box?

$
0
0


When a user selects an item from the drop down list, I want to add an additional description to the right of it like in the image attached. Is there a way to easily do this?

Hide or Disable all the components of DataTables.

$
0
0

First of all this tool is superb and coder friendly, thank you so much for that. I am trying to learn and explore the library. I am using to it on the table and to save the updates of the table I need to check the acknowledgment checkbox in which I have to disable or hide all the controls of the HTML table. Is there any provision for that because pagingType has option to show something at the least. Moreover, I am overriding the lengthMenu to show all records so when I select the option to "show all" is it possible to disable or hide all the page numbers & first, next, previous, last buttons?

editor select 2 not open when click on the select box to show values

$
0
0

i try to work with select 2, i add all the files i need,
but when i try to click on the select box, it didnt open

this is my code


@{ Layout = ""; } <link rel="stylesheet" href="~/css/select2.min.css" /> <script src="~/js/jquery/editor.select2.js"></script> <script src="~/js/jquery/select2.min.js"></script> <script language="javascript" type="text/javascript"> var editor; // use a global for the submit and return data rendering in the examples editor = new $.fn.dataTable.Editor({ ajax:'@Url.Action("GetDataCruisesService", "Service")', table: "#example", fields: [ { label: "שם השירות:", name: "CruisesService.CruisesServiceName", type: "text" }, { label: "שם השייט:", name: "CruisesService.CruiseName", }, { label: "סוג השייט:", name: "CruisesService.CruiseType", type: "select", def: 1 }, { label: "שם החברה המבצעת:", name: "CruisesService.CruiseCompeny", }, { label: "משך השייט בימים", name: "CruisesService.CruiseLength", }, { label: "משך השייט בשעות:", name: "CruisesService.CruiseDurationHour", type: "select2", def: 1 }, { label: "נמל יציאה:", name: "CruisesService.StartPortName", }, { label: "נמל סיום:", name: "CruisesService.FinishPortName", }, { label: "חברה מבצעת:", name: "CruisesService.CruiseProvider", }, { label: "מדינות:", name: "CruisesService.CruiseState", }, { label: "סוג האוניה המבצעת את השייט:", name: "CruisesService.TypeShip", }, ], i18n: { create: { title: "הוספת שייט", submit: "שמור" }, edit: { title: "עדכון", submit: "עדכן" }, remove: { title: "מחיקה", submit: "מחק", confirm: { _: "האם אתה בטוח שברצונך למחוק?", 1: "האם אתה בטוח שברצונך למחוק?" } }, error: { system: "שגיאה, אנא נסו שנית" } } }); var table=$('#example').DataTable({ dom: "Bfrtip", ajax: '@Url.Action("GetDataCruisesService", "Service")', "language": { "processing": '<i class="fas fa-circle-notch fa-spin fa-2x fa-fw"></i><span class="loading">טוען...</span> ', "lengthMenu": "הצג _MENU_ פריטים", "zeroRecords": "לא נמצאו רשומות מתאימות", "emptyTable": "לא נמצאו רשומות מתאימות", "info": "_START_ עד _END_ מתוך _TOTAL_ רשומות", "infoEmpty": "0 עד 0 מתוך 0 רשומות", "infoFiltered": "(מסונן מסך _MAX_ רשומות)", "infoPostFix": "", "search": "חפש:", "url": "", "paginate": { "first": "ראשון", "previous": "קודם", "next": "הבא", "last": "אחרון" }, }, columns: [ { data: null, defaultContent: '', className: 'select-checkbox', orderable: false }, { data: "CruisesService.Service_id" }, { data: "CruisesService.CruisesServiceName" }, { data: "CruisesService.CruiseName" }, { data: "CruiseType.Name_Heb" }, { data: "CruisesService.CruiseCompeny" }, { data: "CruisesService.CruiseLength" }, { data: "CruiseDurationHour.CruiseDurationHour_Id" }, { data: "CruisesService.StartPortName" }, { data: "CruisesService.FinishPortName" }, { data: "CruisesService.CruiseProvider" }, { data: "CruisesService.CruiseState" }, { data: "CruisesService.TypeShip" }, ], select: { style: 'os', selector: 'td:first-child' }, buttons: [ { extend: "create", editor: editor,text:"חדש" }, { extend: "edit", editor: editor, text: "עריכה" }, { extend: "selected", text: 'שכפול שורה', className: "buttons-edit", action: function (e, dt, node, config) { // Start in edit mode, and then change to create editor .edit(table.rows({ selected: true }).indexes(), { title: 'שכפול שורה', buttons: 'שמירה', }) .mode('create'); } }, { extend: "remove", editor: editor, text: "מחיקה" } ] }); </script>

checkbox serverside filter. im using ssp.class.php

$
0
0

Right now I have this code. and it's working but when I check my first check it's working. I want to use checkbox filter to query all the needed values, Like I want to use multiple values in one column I check the check-01 check-03 and check-06 checkbox example d.columns[136].search.value = (01|03|06) but it's now working if I check all of them. right now here is my code.
```
"ajax": {
dataSrc: "data",
url: "serverside.php",
type: "POST",
data: function (d) {
var filter = [];
$('.form-control-2').each(function (index, elem) {
if (elem.checked) filter.push($(elem).val());
});
var filterdata = filter.join('|');
d.columns[136].search.value = filterdata
return $.extend( {}, d, {

                           } );


                     },
                   },

How do you make your own filters and buttons

$
0
0

How do you make your own filters/buttons so you can control the position and what div they are inside?

example:

If I have a header and a footer and want the table to be between, how do I then add the filters/buttons to the header and footer

Select the row using the key

$
0
0

Hi.
I have a table that works great with Editor and KeyTable. So, I can work just like in Excel, only with the help of a keyboard. But to select the row I must click mouse on the left column. This is not convenient.
Is it possible to make select the row through the key, such as a "Space" for example?
I give a part of the code below.
Thank you.

//...
var table = $('#example').DataTable( {
dom: "Bfrtip",
ajax: {
url: "http://localhost/DataTables/staff.php?nick=" + nick + "&start=" + start,
type: 'POST'
},
// serverSide: true,
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "table1.telecast_date" },
{ data: "table1.telecast_time" },
{ data: "table1_telecast_type.type", editField: "table1.telecast_type" },
{ data: "table1.telecast_name" },
{ data: "table1_telecast_genre.genre", editField: "table1.telecast_genre" },
{ data: "table1_telecast_lang.lang", editField: "table1.telecast_lang" },
{ data: "table1_telecast_tak_ni.tak_ni", editField: "table1.telecast_owner" },
{ data: "table1_telecast_tak_ni_ua.tak_ni",editField: "table1.telecast_ua" },
{ data: "table1.telecast_note" },
{ data: "table1.telecast_timing" },
{ data: "table1.nick" },
{ data: "table1.start" }
],
keys: {
columns: ':not(:first-child)',
editor: editor
},
select: {
style: 'os',
selector: 'td:first-child',
blurable: true
},
buttons: [
//...

How do i uncheck all header checkbox using jquery

$
0
0

Hello,

I am using a gyrocode checkbox plugin with my DataTable.
Initially i check some records, edit them and uncheck the checkbox using this below code.

$('input[type="checkbox"]', table.cells().nodes()).prop('checked',false);

Now i again select some other records, this time when i fetch IDs of selected checkbox, previous records are included in the array returned.

So i decided to uncheck the main check box in a header column which will select/ Deselect all the records.
How do i do that ?

Scroller does not observe displayStart

$
0
0

There is an issue with the interaction between Scroller and the displayStart option. The following example shows this in action.

http://live.datatables.net/banimosa/1/edit

The correct records will be loaded, but the Scroller does not modify its initial scroll position to reflect this leaving an empty viewport into the table.

I have also attached a simple patch that remedies this by propogating the displayStart value to the Scroller's 'topRowFloat' value on construct, allowing the scroll position to initialise to the correct position.

Array value on a row

$
0
0

Hi,

I'm new in datatables :-)

How to i get the values from a row in a dropdown filter if the row has the value as an array a,b,c...

Viewing all 82520 articles
Browse latest View live


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