Quantcast
Channel: Recent Discussions — DataTables forums

How can i add multiple values to a single column in datatable

$
0
0

In editor i am usign multiple true to select different values. How do i modify my server-side script to store valules in form of arrays and get them back by joining the values of operator to users table to fetch all the values.
``` {
label: "Operator",
name: 'users_enc[].id',
type: 'datatable',
multiple: true
},

Field::inst('R.operator', 'editoperator')
->options(
Options::inst()
->table('users_enc')
->value('id')
->label(array('lastname', 'firstname'))
->render(function ($row) {
return $row['lastname'] . ', ' . $row['firstname'];
})
->where(function ($q) {
$q->where('blocked', 0, '=');
$q->where('opsPDC', 1, '=');
})
->order('lastname')
)
->setFormatter(Format::ifEmpty(null))
->setFormatter(function ($val, $data, $opts) {
return implode(',', $val);
}),
```


Datatable 2.0 and responsive: Cannot read properties of null (reading '_details')

$
0
0

Link to test case: https://live.datatables.net/wuraxuci/7/edit

Error messages shown:
VM1902 dataTables.js:8076 Uncaught TypeError: Cannot read properties of null (reading '_details')
at HTMLTableElement.<anonymous> (VM1902 dataTables.js:8076:15)
at HTMLTableElement.dispatch (VM1900 jquery-3.7.1.min.js:2:40035)
at v.handle (VM1900 jquery-3.7.1.min.js:2:38006)
at Object.trigger (VM1900 jquery-3.7.1.min.js:2:70124)
at ce.fn.init.triggerHandler (VM1900 jquery-3.7.1.min.js:2:70811)
at _fnCallbackFire (VM1902 dataTables.js:6273:50)
at _fnAdjustColumnSizing (VM1902 dataTables.js:2140:3)
at _Api.<anonymous> (VM1902 dataTables.js:8552:4)
at _Api.iterator (VM1902 dataTables.js:6672:15)
at _Api.<anonymous> (VM1902 dataTables.js:8551:15)

Description of problem: this stopped working after updating to 2.0. Basically i have 2 tables. Each row ends with a + button. If the user clicks on it the item gets moved to table 2. If the table is fully opened it works fine but if you resize the window and click on the button you get the above error in console.

I use a function to get the row

function getDatatableTriggeredRow(trigger_el) { if (trigger_el.closest('li').length) { return trigger_el.closest('tr').prev('tr'); } else { return trigger_el.parents('tr'); } }

and it works fine in every page i use it except for this particular case.

how to change --bs-table-hover-bg,--bs-table-striped-bg colors.bg colors of rows when mouse hover

$
0
0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

CDN links have disappeared?

$
0
0

We have a webapp that uses the datatables CDN and it has suddenly stopped working.

Looking into it, it seems that the CSS and JS files on the CDN no longer exist.

We are using the following URLS:

https://cdn.datatables.net/w/bs/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/datatables.min.css

https://cdn.datatables.net/w/bs/dt-1.10.18/fc-3.2.5/fh-3.1.4/r-2.2.2/datatables.min.js

Is this a known issue? How can we resolve it quickly so our customers can use it again, then what do we need to do to resolve it properly?

Order has changed since version 2

$
0
0

I switched to version 2 last week and since the order is different. Before the order in which the table was created was kept, but now it's not. In the following example the column "Aantal" has the order, but before switching versions, the second order was the column "Datum".

<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="utf-8">
<title>test</title>
<link href="//cdn.datatables.net/2.0.2/css/dataTables.dataTables.min.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="//cdn.datatables.net/2.0.2/js/dataTables.min.js"></script>
<script src="//cdn.datatables.net/plug-ins/2.0.2/filtering/type-based/accent-neutralise.js"></script>
</head>

<body>
    <table id="meeste_achtbanen">
        <thead>
            <tr>
                <th>Achtbanen</th>
                <th>Aantal</th>
                <th>Datum</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><a href="#" class="pretpark" id="59">Energylandia</a></td>
                <td class="center">15</td>
                <td data-order="2021-09-02"><a href="#" class="date" id="2021-09-02">02-09-2021</a></td>
            </tr>
            <tr>
                <td title="Cedar Point, Kennywood"><a href="#" class="pretpark" id="87">Cedar Point</a>, <a href="#" class="pretpark" id="86">Kennywood</a></td>
                <td class="center">13</td>
                <td data-order="2023-07-28"><a href="#" class="date" id="2023-07-28">28-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="9">Europa Park</a></td>
                <td class="center">12</td>
                <td data-order="2019-05-01"><a href="#" class="date" id="2019-05-01">01-05-2019</a></td>
            </tr>
            <tr>
                <td title="Haunted Hoochie, Kings Island, Ohio State Fair"><a href="#" class="pretpark" id="88">Haunted Hoochie</a>, <a href="#" class="pretpark" id="90">Kings Island</a>, <a href="#" class="pretpark" id="89">Ohio State Fair</a></td>
                <td class="center">12</td>
                <td data-order="2023-07-31"><a href="#" class="date" id="2023-07-31">31-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="93">Six Flags Great America</a></td>
                <td class="center">12</td>
                <td data-order="2023-08-03"><a href="#" class="date" id="2023-08-03">03-08-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="84">Six Flags Great Adventure</a></td>
                <td class="center">11</td>
                <td data-order="2023-07-26"><a href="#" class="date" id="2023-07-26">26-07-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="90">Kings Island</a></td>
                <td class="center">11</td>
                <td data-order="2023-08-01"><a href="#" class="date" id="2023-08-01">01-08-2023</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="9">Europa Park</a></td>
                <td class="center">10</td>
                <td data-order="2020-07-29"><a href="#" class="date" id="2020-07-29">29-07-2020</a></td>
            </tr>
            <tr>
                <td><a href="#" class="pretpark" id="59">Energylandia</a></td>
                <td class="center">10</td>
                <td data-order="2021-08-30"><a href="#" class="date" id="2021-08-30">30-08-2021</a></td>
            </tr>
            <tr>
                <td title="Ferrari Land, PortAventura Park"><a href="#" class="pretpark" id="67">Ferrari Land</a>, <a href="#" class="pretpark" id="66">PortAventura Park</a></td>
                <td class="center">10</td>
                <td data-order="2022-04-30"><a href="#" class="date" id="2022-04-30">30-04-2022</a></td>
            </tr>
        </tbody>
    </table>

    <script>
    $('#meeste_achtbanen').dataTable({
        'order': [[ 1, 'desc' ]],
        'searching': false,
        'paging': false,
        'info': false,
    });
    </script>
    
</body>
</html>

Now I know I can change "order" for this example, but I have tables the rely on the order the table is created in.

 'order': [[ 1, 'desc' ], [ 2, 'asc' ]],

2.0.4, and 2.0.5 causing exception on Safari 16.3 and earlier

$
0
0

Link to test case: just load DT 2.0.4 or 2.0.5 in a Safari 16.3 browser or earlier
Error messages shown: SyntaxError: Invalid regular expression: invalid group specifier name
Description of problem: Looks like the recent fix (line 7966 in 2.0.5 not-minified, function __details_state_load) is causing the error shown above in Safari 16.3 and earlier. This is because lookbehind regular expressions are not supported.

While I'd love to not worry about this unfortunately some of our users are impacted.

Hide the seach field

$
0
0

Good morning,
Following the upgrade to DT2, I am replacing the DOM by layout.
It works fine except that I am unable to hide the seach field.
I tried search: false but it does not work.
Any idea on how I can do that?

Why am I having this issue while using data table

$
0
0

Error: node_modules/angular-datatables/src/angular-datatables.directive.d.ts:31:25 - error TS2503: Cannot find namespace 'DataTables'.

31 dtInstance: Promise<DataTables.Api>;
~~~~~~~~~~

Error: node_modules/angular-datatables/src/models/settings.d.ts:3:38 - error TS2503: Cannot find namespace 'DataTables'.

3 export interface ADTSettings extends DataTables.Settings {
~~~~~~~~~~

Error: node_modules/angular-datatables/src/models/settings.d.ts:6:37 - error TS2503: Cannot find namespace 'DataTables'.

6 export interface ADTColumns extends DataTables.ColumnSettings {
~~~~~~~~~~


Cannot find namespace 'DataTables'. 6 export interface ADTColumns extends DataTables.ColumnSettings

$
0
0

Cannot find namespace 'DataTables'.

6 export interface ADTColumns extends DataTables.ColumnSettings {
~~~~~~~~~~

Difficulty getting plug-ins diacritics-sort and natural to work

$
0
0

I must confess to still be using version 1.10.21, which works fine for me, and need time before implementing version 2. I have difficulty getting plug-in diacritics-neutralise to work. I have reduced the table in the test case to 14 entries and modified the first column to test sorting; one thus needs to set the table to display more than 10 entries per page. Note the following:

  • Ökonomie should come before Oracle;
  • schön before Schubert;
  • À propos at the top, followed by (in this order) été, Été, Été, étêter, ethnie;
  • Été is used twice, and été once, but the lowercase version is sorted between the two capitalized ones.

The correct order should thus be: À propos, été, Été, Été, étêter, ethnie, étirer, étoffe, Ökonomie, Oracle, Schomberg, Schön, Schubert, sève. Why is it not achieved?

Furthermore, with regard to the natural plug-in, is it correct to use both “nohtml” and “ci” on two separate lines, or should the two commands be merged and how?

{ type: 'natural-nohtml', targets: '_all'},
{ type: 'natural-ci', targets: '_all'}

Are the following lines equivalent, or is one preferable:

{ targets: 0; type: 'diacritics-neutralise'}
{ type: 'diacritics-neutralise'; targets: '_all' }

SearchBuilder Requires DateTime when used with dates.

$
0
0

I am a newbie but steadily learning. I set up Datatables with jQuery and it is working fine.
When I tried to use DataTables on a PHP generated table I received the error "SearchBuilder Requires DateTime when used with dates.". So I changed the field in the MySQL table from type DATE to type DATETIME. But I am still getting the same error. Do I need to add a jQuery line to my initialization file shown below? If so, could someone provide an example?
Thanks for any assistance. And thanks for a superb product! It is proving very useful for our non-profit organization.
Tim

$( document ).ready(function() { $('#mytable').DataTable( { colReorder: { columns: ':not(:first-child)' }, scrollx: true, responsive: { breakpoints: [ {name: 'bigdesktop', width: Infinity}, {name: 'meddesktop', width: 1480}, {name: 'smalldesktop', width: 1280}, {name: 'medium', width: 1188}, {name: 'tabletl', width: 1024}, {name: 'btwtabllandp', width: 848}, {name: 'tabletp', width: 768}, {name: 'mobilel', width: 480}, {name: 'mobilep', width: 320} ] }, layout: { top1: 'searchBuilder', bottom2Start: 'buttons' }, buttons: ['copy', 'pdf', 'excel'] } ); });

Ajax sourced data

$
0
0

Hello
how can i read from ajax sourced data with unknown header colonne. I mean the data i get from database can varie en terms of number of column. so i need the columns in the table to be dynamically created from javascript.

Some multibyte strings are not found in searches in Absolute Plug-ins

Image upload not working

$
0
0

I also created a project that has image upload part, but I copied it and created a new controller but it is not working only uploads the default image,
The upload path is correct and i changed the model and added part

Export to csv/excel one columns comes with trailing zeroes

$
0
0

correct value to display - 642954427177832
What get displayed - 64295442717783200000


EDITOR DATATABLE AJAX POST IS EMPTY ARRAY ON CI4

$
0
0

Hello,

I need to experiment Editor Datatable on CI4, first attempt everything was working and then all crached. I spend two days trying to found the issue but always failed. if someone can help fix it.

Credentials :

https://comebillets.com/agenceamani.com/login
Login : admin@example.com
Pass: admin

Editor link : https://comebillets.com/agenceamani.com/loyers

DataTables warning: table id=loyersTable - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1:
Status code 200 OK but $_POST variable is empty on the CI4 controller

Column width not displaying correctly

$
0
0

Link to test case: https://phase2.petroleum-containment.com/find-an-installer/
Debugger code (debug.datatables.net): atibej
Error messages shown: No message shown
Description of problem: I'm brand new to jQuery and to DataTables. I followed the documentation as closely as I could and have the table mostly functioning the way I want. However, on some browsers, the width of the table isn't correctly. Upon inspecting the HTML, it appears that all of the columns are being squished into the first "colgroup". I'm using Bricks builder for Wordpress but I think I've set my HTML elements correctly. I've noticed that this only happens in Chrome and Arc (that I've tested). Safari seems to show it accurately.

Here's my JS:

  
$(document).ready( function () {
    $('#installerTable').DataTable( {
      paging: false,
      select: true,
      autowidth: false,
      select: {
        items: 'row',
        selector: 'td:first-child'
      },
      responsive: true,
      columnDefs: [
        {searchable: false, targets: [3, 4]},
        {orderable: false, targets: [3, 4]}
      ],
      stateSave: false,
      "oLanguage": {
             "sSearch": "Search name, company, or state:"
            }
      
    } );
} );
  

How long should it take to generate Data Table with 50000 rows and 100 column.

$
0
0

Just running some benchmarks to see if the speed I get is normal due to the large amount of data or something in my code is not correct. So I decided to generate a Data Table with no other processing (render callbacks or cell/row elements processing) involved.

I have used an custom method to generate a data array with **50000 **rows and **100 **columns. It would look something like:

    const DATA_ARRAY = [
        { "Column 1": 9999, "Column 2": 9999, "Column 3": 9999, ....... , "Column 100": 9999 },
        { "Column 1": 9999, "Column 2": 9999, "Column 3": 9999, ....... , "Column 100": 9999 },
    ];

I have a custom method that would auto-generate the "columns" data needed and assigned is to a COLUMNS_DATA constant.

I have added my plain table element <table></table> to the DOM. Since I am using jQuery, I have the jQuery object for table in a $TABLE constant.

I have created a data/object that will contain the "data" and "columns" information:

const SETTINGS_DATA = { 'data': DATA_ARRAY, 'columns': COLUMNS_DATA };

I then ran the Data Tables method to generate the Data Table:

$TABLE.DataTable(SETTINGS_DATA );

From that last call, it took 50 seconds before the table showed up on my page in the Chrome browser. The browser sometimes did the "Aw, Snap" because it ran out of memory.

I did a few more test:

  • With 50 columns, it took 23 seconds.
  • With 25 columns, it took 9 seconds.
  • With 15 columns, it took 5 seconds.
  • With 5 columns, it took 2 seconds.

Maybe it would be better to use the server-side option, but trying to see if the speed I am getting is expected for that amount of data.

Custom File Upload PHP Script

$
0
0

HI,

I'm using a custom backend built with MODX. I have everything working nicely except reading back the data of uploads. I don't really understand how this part works.

My server code looks like this:

    if ($_POST['action'] === 'upload') { // image uploaded via AJAX
    
        function processName($file){
            $path_parts = pathinfo($file);
            $filename = $path_parts['filename'];
            $ext = $path_parts['extension'];
            $newfilename = preg_replace( '/[^a-z0-9]+/', '-', strtolower( $filename ) );
            $newfilename = $newfilename .uniqid().'.'.$ext;
            return $newfilename;
        }
    
        if (is_uploaded_file($_FILES['upload']['tmp_name'])){
            $newfilename = processName($_FILES['upload']['name']);
            move_uploaded_file($_FILES['upload']['tmp_name'], 'images/debugnfixes/'.$newfilename);
            
            $tableRow = $modx->newObject('system21extras\Model\ExtrasBugsnFixesImages');
            $tableRow->set('filename', $newfilename);
            $tableRow->save();
            $tableData = $tableRow->toArray();
            
            $data = array(
                "data" => array(),
                "files" => array(
                    "files" => array(
                        "1" => array(
                            "id" => "1",
                            "filename" => $newfilename,
                            "web_path" => 'images/debugnfixes/'.$newfilename,
                        )
                    )
                ),
                "upload" => array(
                    "id" => $tableData['id']
                )
            );
            
            return json_encode($data, JSON_UNESCAPED_SLASHES);            
        }        

    }

The upload section of the form looks like this:

{
            label: "Screen:",
            name: "screen",
            type: "upload",
            display: function ( id ) {
                return '<img src="'+editor.file( 'system21extras_bugsnfixesimages', id ).webPath+'"/>';
            },
            noImageText: 'No image.'
},

The file is uploaded and the database updated.
I get this console error: Unknown file table name: system21extras_bugsnfixesimages

I don't really understand how the form code above uses the returned data from the backend to show the uploaded file. Also when the table is displayed, how do the upload fields get the image data?

Thanks,
Andrew

unable to extract child row values

trying to reload the ajax div adn inside trying to call a datatables which accepts value from server

$
0
0

I have a code whyere my form submits to a new page and that new Page is loaded i the parent page because of Ajax, now the problem, its bringing the JSON response but unable to map it, i get an error and apart from that, it calls the action page and then it calls the parent page again, why it doing, seems kind of event bubbling, can't figure out, here is my code for that

i included the relevant datatables JS files in the Page

<div id="contentDiv"></div>
        <script>
            $('#ReportTimeSheet').on('click', function(event) {
                event.preventDefault(); // Prevent the form from submitting normally
                showLoadingScreen();
                $.ajax({
                    url: $(this).attr('data-action'),
                    method: $(this).attr('data-method'),
                    data: $(this).serialize(),
                    success: function(data) {
                        showUnloadingScreen();
                        // Initialize DataTable
                        $('#contentDiv').html('<table id="dataTable" class="display" style="width:100%"></table>');
                        $('#dataTable').DataTable({
                            data: data, // Assuming 'data.data' contains the array of data
                            columns: [
                                { data: 'AdjustedDate' },
                                { data: 'AdjustedStandardHours' },
                                { data: 'Aprvd_dt' },
                                { data: 'Chargey' },
                                { data: 'ChargJob' },
                                { data: 'Sbmtd_dt' }
                            ],
                            serverSide: true,
                            processing: true,
                            ajax: {
                                url: $(this).attr('data-action'),
                                type: 'POST',
                                data: function(d) {
                                    d.start = d.start || 0;
                                    d.length = d.length || 10;
                                    d.search = d.search.value;
                                }
                            }
                        });
                    },
                    error: function(jqXHR, textStatus, errorThrown) {
                        showUnloadingScreen();
                        $('#contentDiv').html('An error occurred: ' + errorThrown);
                    }
                });
                event.stopPropagation(); // Stop event propagation
            });
        </script>

my html form code

<form name="ReportTimeSheet" id="ReportTimeSheet" data-action="TimesheetAuto_Proc.cfm" data-method="POST">
                <input type="HIDDEN" name="whichDSN" value="Main">
<input type="button" name="GetReport" value="Get report;">
</form>

the error i am getting is:

**DataTables warning: table id=dataTable - Requested unknown parameter 'AdjustedDate' for row 0, column 0. For more information about this error, please see https://datatables.net/tn/4**

problem with OrderFixed on a complex DT (row group, responsive, etc)

$
0
0

Link to test case: https://live.datatables.net/xoqasoga/16/edit
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Hi,

I Have 3 problems/questions on a DT 2.0 with rowgroup (responsive and other extensions)

1) Problem width OrderFixed

I've created a test case with (almost) real data, but the output doesn't work and I don't find the reason why.
So I've put screenshot to try to explain.
At least, you can see the JS content here :
https://live.datatables.net/xoqasoga/16/edit

If I add a fixed order on the column Date with orderFixed: [2, 'desc'].

This is how the table look like :
- the fixed order is good
- a triangle is showing at the top of the column 0 (it doesn't happen with an order « not fixed » order: [2, 'desc'])
- sorting the other columns doesn't work anymore (it doesn't happen with an order « not fixed » order: [2, 'desc'])

This is part of the DT code :

        orderFixed: [2, 'desc'], // tri fixe pour la rupture (dateDebut)
        responsive: {
            details: {
                type: 'column',
                target: 'tr',
                renderer: function (api, rowIdx, columns) {
                    var data = $.map(columns, function (col, i) {
                        return col.hidden
                            ? '<p class="has-text-grey px-2 py-2"><span class="has-text-weight-semibold smallcaps">'+ col.title + ' : </span>' + col.data + '</p>'
                            : '';
                        }).join('');
                    return data ;
                }
            }
        },
        rowGroup: {
            dataSrc: 'dateDebut.annee', // groupe pour rupture
            startClassName: 'rupture has-text-' + interfaceBB, 
            endClassName: 'soustotal has-text-' + interfaceBB, 
            startRender: function ( rows, group ) {
                return 'IMMOBILISATIONS ' + group + '<span class="is-pulled-right">('+rows.count()+')</span>';
            },
            endRender: function (rows, group) {
                
                // sous-totaux par groupe 
                
                var subtotalAchat =
                    rows
                        .data()
                        .pluck('Montant1')
                        .reduce(function (a, b) {
                            return a + b * 1;
                        }, 0) ;

                var subtotalCession =
                    rows
                        .data()
                        .pluck('Montant2')
                        .reduce(function (a, b) {
                            return a + b * 1;
                        }, 0) ;

                subtotalAchat = DataTable.render.number(' ', ',', 2, null, '').display(subtotalAchat);
                subtotalCession = DataTable.render.number(' ', ',', 2, null, '').display(subtotalCession);

                return $('<tr/>')
                .append('<td colspan="10" class="has-text-right has-text-weight-semibold">TOTAL ' + group + ' (' + rows.count() + ')</td>')
                .append('<td class="has-text-right has-text-weight-semibold">' + subtotalAchat + '</td>')
                .append('<td></td>')
                .append('<td class="has-text-right has-text-weight-semibold">' + subtotalCession + '</td>')
                .append('<td></td>');
            }
        }

2) Rowgroup & Responsive : How counting the <td> ?

In the same DT, with RowGroup I'm adding subtotals for each group, and a global total as you can see on the capture below.

But the DT is responsive and I don't know how I could count the visible <td> to add the good value in the colspan in the subtotal in the endRenderof rowgroup.

I don't have the problem with the footerCallbackfor the global total because the JS code is different.

Here, the subtotals have the right value in colspan because all columns are visible :

Here, the window is smaller, some columns on the right are hidden and the subtotals <tr> doesn't look good (because of my code !) To be perfect, I should change the colspan and also hide the same columns) :

3) FixedHeader, alignement problems

As you can see on the last 2 screenshots, the title columns in the fixed header doesn't have the same width of the content <td>.
I thought this problem was solved in DT 2.0.
Maybe, I should change something in my JS or HTML code ?

Thank you for your patience reading this long message (full of typos) and your help


hidden row search in datatable

$
0
0

ask for help sir,
how to remove row search in the following PDF export. I've tried searching but I haven't found it.

Thank You

print-copy-excel-doesnt-print-selected-option-value

$
0
0
<table id="example" class="myTable hover nowrap" style="width:100%">

                <thead>
                    <tr>
                        <th>Invoice No</th>
                        <th>Brand</th>
                        <th>Model</th>
                        <th>IMEI</th>
                        <th>Shop Name</th>
                        <th>Status</th>
                        <th>Entered By</th>
                        <th>Insert at</th>
                        <th>Customer Name</th>
                        <th>Options</th>
                    </tr>
                </thead>
                <tbody>
             
                        <tr id="">
                            <td><?php echo $fetchrepair['invoice_no']; ?></td>
                            <td><?php echo $fetchrepair['brand']; ?></td>
                            <td><?php echo $fetchrepair['makemodel']; ?></td>
                            <td><?php echo $fetchrepair['imei']; ?></td>
                            <td <?php echo ($_SESSION['user_type'] == 'admin') ? '' : 'hidden'; ?>><?php echo $fetchrepair['shop_name']; ?></td>
                            <td><?php echo '<select class="' . $getcolor . '" name="changestatus" onchange="saveinfo(' . $fetchrepair['id'] . ',this.value,\'repair_status\');" required style="width: 150px;">
                                <option value="" disabled selected>Choose</option>
                                <option value="0"' . ($fetchrepair['repair_status'] == '0' ? ' selected' : '') . '>In Progress</option>
                                <option value="1"' . ($fetchrepair['repair_status'] == '1' ? ' selected' : '') . '>Pending</option>
                                <option value="2"' . ($fetchrepair['repair_status'] == '2' ? ' selected' : '') . '>Fixed</option>
                                <option value="3"' . ($fetchrepair['repair_status'] == '3' ? ' selected' : '') . '>Not Fixed</option>
                                </select>
                                    '; ?>
                            </td>
                            <td><?php echo $fetchrepair['f_name'] . " " . $fetchrepair['l_name']; ?></td>
                            <td><?php echo date('d/m/Y H:i:s', strtotime($fetchrepair['crt_date'])); ?></td>
                            
                            <td><?php echo $fetchrepair['cus_name']; ?></td>
                            <td>
                                <a href="generateInvoice.php?invoiceno=<?php echo $fetchrepair['repairID']; ?>" title="Print Invoice" class="btn btn-warning text-white mb-2">
                                    <i class="fa-solid fa-print"></i>
                                </a>
                                <a href="update-mobile-repair?editrepair=<?php echo $fetchrepair['repairID']; ?>" class="btn btn-info text-white mb-2">
                                    <i class="fa-solid fa-pen-to-square"></i>
                                </a>
                                <button <?php echo ($_SESSION['user_type'] == 'Shop') ? 'hidden' : ''; ?> onclick="del(delrepair,<?php echo $fetchrepair['repairID']; ?>);" type="button" class="btn btn-danger mb-2">
                                    <i class="fa-solid fa-trash"></i>
                                </button>
                            </td>
                        </tr>
                    <?php
                    }
                    ?>
                </tbody>
                <tfoot>
                    <tr>
                        <th>Invoice No</th>
                        <th>Brand</th>
                        <th>Model</th>
                        <th>IMEI</th>
                        <th <?php echo ($_SESSION['user_type'] == 'admin') ? '' : 'hidden'; ?>>Shop Name</th>
                        <th>Customer Name</th>
                        <th>Entered By</th>
                        <th>Insert at</th>
                        <th>Status</th>
                        <th>Options</th>
                    </tr>
                </tfoot>
            </table>

The 6th column is for status (select) and when I print it I see all 4 status being printed instead of just the selected value,

Scroller plugin shows wrong numbers in info part when scrolling

I have purchased the Editor license almost 2 months. I still can't figure out how to use.

$
0
0

Hi,

I have already purchased the Editor license (one developer) for almost 2 months. I can't even list the Table as before. It just feezed on screen. I still can't figure out how I can make use of the Editor for inline editing. Can I send in the programs for checking and advise?

Keith Wong

table.column("#").visible() no longer falsey

$
0
0

It used to be that

if (table.column("#ID").length > 0 && table.column("#ID").visible()))

Would go down the false when the column didn't exist (it's not added in the initial render depending on permissions) but now the table.column("#ID").visible() is returning the datatable object, which javascript interprets as "yes there is an object" and enters the condition.

The dreaded "Requested unknown parameter for row 0, column 0"

$
0
0

Another hair-tearing-out problem! I cannot figure out why I am getting this error, no matter how I configure the columns. I have tried different sets of columns but the first one is always throwing up this error.
Here is my dead simple PHP:

    Editor::inst( $db, 'TApplications' )
        ->fields(

            Field::inst( 'TApplications.purpose' ),
            Field::inst( 'TApplications.reqtotal')
        ) 
        ->where ('TApplications.successful','No','!=')      
        ->debug(true)
        ->process( $_POST )
        ->json();

Javascript:

var spreadsheetTable = new DataTable('#Sheet', {

 ajax: 'php/table.TApplicationsSpreadsheet.php',

 columns: [
               {
                   "data": "purpose"
               },
               {
                  "data": "reqtotal", "label":"Total Requested"
                }
            ],
            dom: 'Bfrtip',
            scrollY: "500px",
            "paging": false,
            "autoWidth": false 
        } );

HTML:

<h1>Applications Spreadsheet</h1>

<div class="container" style="width:90%; padding-left: 70px">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="Sheet" >
<thead>
<tr>
<th>Purpose</th>
<th>Total Requested</th>
</tr>
</thead>
</table></div>

And the data being returned looks like this:

data
:
[{DT_RowId: "row_5",…}, {DT_RowId: "row_11",…}, {DT_RowId: "row_12",…},…]
[0 … 99]
0
:
{DT_RowId: "row_5",…}
DT_RowId
:
"row_5"
TApplications
:
{purpose: "Project Worker salary + associated core costs", reqtotal: "35555.0000"}
1
:
{DT_RowId: "row_11",…}
DT_RowId
:
"row_11"
TApplications
:
{purpose: "Replace Lottery Funding for Training Co-ord", reqtotal: "26584.0000"}

But I get this error message:

DataTables warning: table id=Sheet - Requested unknown parameter 'purpose' for row 0, column 0. For more information about this error, please see https://datatables.net/tn/4

Note that this happens no matter which combination of columns I try (so far at least).

So what is going wrong? Apologies if this is really obvious.

How to Display large column value On front dyanamic

$
0
0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:


Set column (max) width

$
0
0

I'm looking for a way to set the max width or width of a single column in a DataTable.
I tried "columnDefs width" but this did not affect the width of the column.

This is the configuration of DataTables I'm using: https://datatables.net/download/#bs5/jszip-2.5.0/dt-1.11.3/b-2.0.1/b-colvis-2.0.1/b-html5-2.0.1/b-print-2.0.1/cr-1.5.4/r-2.2.9
Maybe "columnDefs " does not work with the Responsive plugin?
Is there another way to set the max-width or width of a column.

How my table currently looks (the last column is far too wide):

The code used to create the table:

{
    "language": {
        "aria": {
            "sortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
            "sortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
        },
        "emptyTable": "Keine Daten vorhanden",
        "info": "_START_ bis _END_ von _TOTAL_ Einträgen",
        "infoEmpty": "0 bis 0 von 0 Einträgen",
        "infoFiltered": "(gefiltert von _MAX_ Einträgen)",
        "lengthMenu": "_MENU_ Einträge anzeigen",
        "loadingRecords": "Wird geladen...",
        "paginate": {
            "first": "Erste",
            "last": "Letzte",
            "next": "Nächste",
            "previous": "Zurück"
        },
        "processing": "<div class='processingWrapper hidden-print'><i class='far fa-spinner fa-spin'></i><p>Bitte warten...</p></div>",
        "search": "Suchen",
        "zeroRecords": "Keine Einträge vorhanden.",
        "thousands": ".",
        "infoPostFix": "",
        "decimal": ""
    },
    "stateSave": true,
    "stateDuration": 604800,
    "lengthMenu": [
        [
            10,
            20,
            50,
            100,
            500
        ],
        [
            "10",
            "20",
            "50",
            "100",
            "500"
        ]
    ],
    "pageLength": 10,
    "processing": true,
    "responsive": true,
    "ajax": {
        "url": "/AdvertisementCampaign/GetAtmGroupsOfCampaign?advertisementCampaignId=4",
        "type": "POST"
    },
    "columns": [
        {
            "name": "Id",
            "orderable": false,
            "visible": true,
            "responsivePriority": 10000,
            "render":renderIdColumn,
            "useAsGroupingColumn": false,
            "data": "Id",
            "searchable": false
        },
        {
            "name": "Name",
            "orderable": true,
            "visible": true,
            "responsivePriority": 10000,
            "useAsGroupingColumn": false,
            "data": "Name",
            "searchable": true
        },
        {
            "name": "Description",
            "orderable": true,
            "visible": true,
            "responsivePriority": 10000,
            "useAsGroupingColumn": false,
            "data": "Description",
            "searchable": true
        }
    ],
    "serverSide": true,
    "order": [
        [
            1,
            "asc"
        ]
    ],
    "dom": "<'dt-toolbar'<'container-fluid'<'row'<'col-xs-12 col-sm-6 col-md-3 dataTableToolBarLeft hidden-print'l><'col-xs-12 col-sm-6 col-md-9 hidden-print dataTableToolBarRight'BT>>>>tr<'dt-toolbar-footer'<'container-fluid'<'row'<'col-md-4 col-lg-4 d-none d-md-block'i><'col-sm-12 col-md-8 col-lg-8 hidden-print pull-right'p>>>>",
    "buttons": {
        "dom": {
            "button": {
                "className": "btn"
            },
            "buttonLiner": {
                "tag": null
            }
        },
        "buttons": [
            {
                "dom": {
                    "button": {
                        "className": "btn"
                    },
                    "buttonLiner": {
                        "tag": null
                    }
                },
                "text": "Drucken",
                "extend": "print",
                "className": "btn-outline-primary dt-btn-action d-none d-md-block",
                "autoClose": true,
                "exportOptions": {
                    "columns": ":visible.export",
                    "format": {
                        "header":window.LsDataTables.getColumnTitle
                    }
                },
                "orientation": "landscape",
                "pageSize": "LEGAL"
            },
            {
                "dom": {
                    "button": {
                        "className": "btn"
                    },
                    "buttonLiner": {
                        "tag": null
                    }
                },
                "text": "Kopieren",
                "extend": "copyHtml5",
                "className": "btn-outline-primary dt-btn-action",
                "autoClose": true,
                "exportOptions": {
                    "columns": ":visible.export",
                    "format": {
                        "header":window.LsDataTables.getColumnTitle
                    }
                },
                "orientation": "landscape",
                "pageSize": "LEGAL"
            },
            {
                "dom": {
                    "button": {
                        "className": "btn"
                    },
                    "buttonLiner": {
                        "tag": null
                    }
                },
                "text": "Exportieren",
                "extend": "collection",
                "className": "btn-outline-primary dt-btn-action",
                "autoClose": true,
                "orientation": "landscape",
                "pageSize": "LEGAL",
                "buttons": [
                    {
                        "dom": {
                            "button": {
                                "className": "btn"
                            },
                            "buttonLiner": {
                                "tag": null
                            }
                        },
                        "text": "CSV",
                        "extend": "csvHtml5",
                        "className": "btn-outline-primary",
                        "autoClose": true,
                        "exportOptions": {
                            "columns": ":visible.export",
                            "format": {
                                "header":window.LsDataTables.getColumnTitle
                            }
                        },
                        "orientation": "landscape",
                        "pageSize": "LEGAL"
                    },
                    {
                        "dom": {
                            "button": {
                                "className": "btn"
                            },
                            "buttonLiner": {
                                "tag": null
                            }
                        },
                        "text": "Excel",
                        "extend": "excelHtml5",
                        "className": "btn-outline-primary",
                        "autoClose": true,
                        "exportOptions": {
                            "columns": ":visible.export",
                            "format": {
                                "header":window.LsDataTables.getColumnTitle
                            }
                        },
                        "orientation": "landscape",
                        "pageSize": "LEGAL"
                    }
                ]
            },
            {
                "dom": {
                    "button": {
                        "className": "btn"
                    },
                    "buttonLiner": {
                        "tag": null
                    }
                },
                "extend": "reload",
                "className": "btn-outline-primary dt-btn-action",
                "autoClose": true,
                "orientation": "landscape",
                "pageSize": "LEGAL"
            }
        ]
    }
}




Latest Images