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

Not Working - Changing the width using "columnDefs" OR "columns"

$
0
0

Link to test case:
columns: http://live.datatables.net/garizemo/1/edit
columnDefs: http://live.datatables.net/powuboco/1/edit
Debugger code (debug.datatables.net):
$(document).ready( function () {
$('#example').dataTable( {
"columns": [
{ "width": "15px" },
null,
null,
null,
null
],
} );
} );
Error messages shown:
columns error: Uncaught TypeError: Cannot read properties of undefined (reading 'mData')
columnDefs error: none
Description of problem:
The width of the columns do not change. It does not matter whether I put "columns" or "columnDefs". How can I change the widths?

I have been trying to apply this guide to no avail: https://datatables.net/reference/option/columns.width

I am using DataTables 1.11.1 on my actual (not test case) project.

Is there any way I can just disable all javascript auto sizing and allow me to style using CSS? I've found it's frustrating having to change styles with javascript.


Using checkboxs to filter data

$
0
0

I have try this code: http://live.datatables.net/rosahuka/1/edit
the idea i have is similar like the example, but with date filters, for example
checkbox today
checkbox this week
checkbox this month
how can i modify that example code so it dosent take the value exactly as it is, like for example
<input type="checkbox" name="pos" value="Director">Director
<input type="checkbox" name="pos" value="Direct">Director
So the value dosen´t have to be the same in order to filter

API de pesquisa de coluna com server side processing.

$
0
0

Alguém poderia me mostrar um exemplo do uso da API de pesquisa de coluna junto com processamento do lado do servidor?

Sorting of Search Panes

$
0
0

Hi!

Is there any possibility, to sort my SearchSelect-List ?

My Site: https://p582810.webspaceconfig.de/suche-dynamic
Use the standard-values, to look the datatable

I have in my datatable a column with age-classes (AKL), they are called e.g. "U07-1" for People af age 6, or "U19-2" for people of age 17. These names are part of the nomenclature of the customer. Now this list is sorted alphabetical, but i want to sort this list by myself.
Is there any possibility?

Thanks for your answer - and excuse my english!
Hubert

Why does a non-default value for `scrollY` cause unchecking of a pre-checked radio button?

$
0
0

Link to test case: live.datatables.net/vuyucuve/1/edit

Description of problem: On a page with a radio button group, with one of the buttons hard-coded as checked, setting any value for the DataTables option scrollY (other than the default empty string) causes that checked button to become unchecked.

This goofy/esoteric bug was confirmed using the above test case with Chrome (Version 97.0.4692.71 (Official Build) (x86_64)) and Safari (Version 15.2 (15612.3.6.1.8, 15612)) on MacOS Catalina 10.15.7 (19H1615) and also Chrome & Firefox on Android 8.

Excel Export Error

$
0
0

Link to test case:

Error messages shown: Excel shows Alert dialog: We found a problem with some content...
Description of problem: For the first row only it gives the error and shows NaN instead of the part number in excel

How is span option used in Buttons 2.2.2 ?

$
0
0

I don't quite understand the new "span" option. How is this used to limit the size? Do you just designate a fixed number of pixels ?
https://datatables.net/reference/button/collection

I have been using css and hacking a class using the collectionLayout.

Like this.

buttons: [
                {
                    extend: 'savedStatesCreate',
                    collectionLayout: 'rcoi-dt-state-restore-button-group-hack',
...

css

        .rcoi-dt-state-restore-button-group-hack {
            width: 350px !important;
        }

display:table-row-group not working with version dt-1.11.3

$
0
0

Hi,
Following this example https://datatables.net/examples/api/multi_filter.html i have Individual column searching implemented.
And following some comments i am showing the footer search at the top.
tfoot { display: table-row-group; }
Everything was working fine until i updated datatables from 1.10.24 to 1.11.3.
Seems like display: table-row-group does not have any affect.
Did not changed any code.The code is excly the same.
my old cdn
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.10.24/b-1.7.0/sl-1.3.3/datatables.min.css" />

my new cdn
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.11.3/b-2.1.1/sl-1.3.4/datatables.min.css" />

Can someone please help.
Thank you


Simultaneously filter multiple data from a same column

$
0
0

taking this as an example: https://datatables.net/
how can i simultaneously search for Angelica Ramos and Airi Satou, so that with only one search i can have both names

How to switch the timezone of DateTime from UTC to other when using the date range filter

$
0
0

Hi All,
I am new to frontend and Datatable. When I tried to use date range filter, the timezone of datetime shown in the calender is UTC, and I wanted that datetime to show in EST. Below are the figures, I have the datetime range work on the third column.
As you can see, when datetime range started by 05:05, there are two entries displayed, which arrival time is 00:05 by EST and 05:05 by UTC. And when datetime range started by 05:06, two entries are no longer displayed. Can anyone tell me how to have date filter show the time in EST, instead of UTC?

datatable

$
0
0

jquery().dattable() is not a function

Rebuild searchBuilder issue

$
0
0

We have store state of current datatable in database column in json format including searchbuilder, column visibility, ordering all details using below api

("#example").dataTable().api().state();

While apply searchbuilder criteria using below api it takes 10/15 seconds. and for each criteria hits server(multiple server calls)

$("#example").searchBuilder.rebuild(data.searchBuilder);

Any other option to apply searchbuilder criteria instead of rebuild ?

Display new created rows on top

$
0
0

Hello,
I'm looking for a simple way to display each new created row on top of table.
I create my new rows inline.

I need something close to this example : https://codepen.io/quanghuy1294/pen/OgNELB
But when I try it, it works but creates few problems with my datatable structure : After create a new row, edit the last one, update the first one too... I'm using an inline edit too.

If you know a simpler way to handle this, thank you to share it!

Problem with the where condition which is not taken into account

$
0
0

Hello,

I have a problem with this code which runs fine but the conditions where not taken into account.
I tried multiple solutions. Always the same result.

product.supp is INT
product.archive is INT
I want to exclude all rows that are 1 for either

<?php
// DataTables PHP library
include( "../Editor-PHP-1.9.1/lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;
    
    
    
Editor::inst( $db, 'produit_prix' )
    ->field(
        Field::inst( 'produit_prix.produit_id' )
            ->options( Options::inst()
                ->table( 'produit' )
                ->value( 'id' )
                ->label( 'produit' )
            )
            ->validator( Validate::dbValues() ),
        Field::inst( 'produit_prix.prix' ),
        Field::inst( 'produit_prix.saison' ),
        Field::inst( 'produit_prix.last_update')
          ->setValue( date('c') )
          ->getFormatter( 'Format::date_sql_to_format', 'jS F Y' ),
        Field::inst( 'produit.produit' ),
        Field::inst( 'produit.supp' ),
        Field::inst( 'produit.archive' )
    )
    ->leftJoin('produit', 'produit.id', '=', 'produit_prix.produit_id')
    ->where('produit.supp', '1', '!=' )
    ->where('produit.archive', '1', '!=' )
    ->process($_POST)
    ->json();

Server-side processing and SQL command timeout with .NET library

$
0
0

I'm using server-side processing and ajax request are handled with DataTables .NET library like:

var connection = ... // System.Data.Common.DbConnection
var db = new Database("azure", connection);
var response = new Editor(db, ...).Process(Request).Data();

There seems to be built-in 30 second CommandTimeout (not to be confused with ConnectionTimeout which is set in database connection string or Ajax request timeout set in client side).

I've crawled through all documentations but could not find a way to set timeout for the SQL command. Any help? Some of my requests in a multi-billion row data takes minute and we can live with that.


GitHub tags not updated after version 1.10.21

$
0
0

Hello Community members,
Hope everyone is doing great. Please help me to understand below question:

Description of problem:
Why the tags are not updated on GitHub after version 1.10.21 ?
https://github.com/DataTables/DataTables/tags

Current datatables version is 1.11.4

Regards,
Nitin

How do I combine 2 MySql fields in one?

$
0
0

Hi,

I am using server-side script and was wondering how to combine to fields in one?. I put together the below and was looking to return both first and last name to a cell in datatables table. Is this how you would do it? If so it doesnt work for me? SOme users do not have a first or last name entered in the database
@allan you helped me before so adding you again :smiley:

$columns = array(
    array( 
       'db' => 'first_name', 
       'db' => 'last_name'
       'dt' => 0 ),
        'formatter' => function( $d, $row ) {
            return $row['first_name'].' '.$row['last_name'];
        }
    ),
    array( 'db' => 'position',   'dt' => 2 ),
    array( 'db' => 'office',     'dt' => 3 ),
    array(
        'db'        => 'start_date',
        'dt'        => 4,
        'formatter' => function( $d, $row ) {
            return date( 'jS M y', strtotime($d));
        }
    ),
    array(
        'db'        => 'salary',
        'dt'        => 5,
        'formatter' => function( $d, $row ) {
            return '$'.number_format($d);
        }
    )
);

No Select on SearchPanes, when loadling language.json thru url

$
0
0

see test: http://live.datatables.net/suqirihi/1/edit

When adding

            language: {
                url:  "http://cdn.datatables.net/plug-ins/1.11.4/i18n/de_de.json"
            }

to a SearchPanes Table, it is not possible to click the filter values. Removing the URL or even putting the json String inside language solves the problem as workaround.

initialization:

$(document).ready( function () {
table = $('#example').DataTable({
dom: 'Pfrtip',
language: {
url: "http://cdn.datatables.net/plug-ins/1.11.4/i18n/de_de.json"
}
});

} );

In Server-Side processing unable to search and paginate for data from diff db tables

$
0
0

Hello @allan
We are using Server-Side processing for our table. The data in the table is being called from 3 different mysql tables.
1. We are in a position where we cannot search the user request through general search and column filter search for the data displayed from a different table. General search & Column Filter Search works only from a single table.
Ex: Unable to search "Receivable" and "Receivable Advance" as the data is arriving from a different table.
2. The table rows displayed shows all the 13 entries irrespective of "show 10 entries.". So pagination isn't working for us.

Can you help us to know where we are wrong?_ Unable to create a test case by having different tables._
Attaching a screenshot and the script for your reference.

How to use Complex header in column visibility ( Toggle) buttons using datatables.

$
0
0

Hello.. I would like to use column visibility toggle buttons for few columns. I used complex header and each header have same named sub columns. I want to make toggle button with the name of complex header column and want to hide and show sub columns ( Planned, Forecast, Actual column) when user click on toggle button. Right now I used columnsToggle which only display sub column names (3 toggle buttons). Here is my code. Thank you.

<table id='assyntCx_Table' class='stripe row-border order-column' style="width:100%">
          <thead>



                        <th class='text-center', rowspan="2">Location</th>
                        <th class='text-center', rowspan="2">Drawing ID</th>
                        <th class='text-center', rowspan="2">Status </th>


                        <th class='text-center', colspan="2">Levels</th>
                        <th class='text-center', colspan="3">Mechanical/Side COP Mechanical Drawings</th>



            </tr>

        <tr class=''>

                        <th class='text-center'>Higher</th>
                        <th class='text-center'>Lower</th>
                        <th class='text-center'>Planned</th>
                        <th class='text-center'>Forecast</th>
                        <th class='text-center'>Actual</th>




              </tr>
            </thead>
        </table>
      </div>
    </div>
  </div>
</div>

<script type="text/javascript" language="javascript" class="init">


var editor;


$(document).ready(function() {



  var editor = new $.fn.dataTable.Editor( {
    ajax: "../ajax/at/elevators.php",
    table: "#assyntCx_Table",
    template: '#customForm',
    fields: [ 



    { 
        label: 'assetid', 
        name: 'E.assetid',
        type: 'hidden',


    },

    { 
        label: 'Location', 
        name: 'Location',
        type: 'select',
        //attr:{disabled:true},

        placeholderDisabled: false,
        placeholder: "Select location"

      },

    { 
        label: 'Drawing ID', 
        name: 'A.dwgTag',
       // type: 'readonly',
        //attr:{disabled:true},


    },

    { 
        label: 'Higher', 
        name: 'Higher',
        type: 'select',
        placeholderDisabled: false,
        placeholder: "Choose Level"


    },
    { 
        label: 'Lower', 
        name: 'Lower',
        type: 'select',
        placeholderDisabled: false,
        placeholder: "Choose Level"


    },

    // { 
    //     label: 'Status', 
    //     name: 'E.elevatorStatus',
    //     type: 'select',
    //     placeholderDisabled: false,
    //     placeholder: "Select Status"


    // },

      { 
        label: 'Planned', 
        name: 'MSDPlanned',
        type:   'datetime',


      },
      { 
        label: 'Forecast', 
        name: 'MSDForecast',
        type:   'datetime',


      },

      { 
        label: 'Actual', 
        name: 'MSDActual',
        type:   'datetime',


      },



    ],
    formOptions: {
            main: {
                scope: 'cell' // Allow multi-row editing with cell selection
            }
        },


  } );




  var table = $('#assyntCx_Table').DataTable( {
    dom: "lBfrtip",



    //AJAX
    //serverSide: true,
    processing: true,
    ajax: {
      url: "../ajax/at/elevators.php",
      type: "POST",
      deferRender: true,
    },

    //TABLE WINDOW
    scrollY:        "65vh",
    scrollX:        true,
    scrollCollapse: false,
    paging:         true,
    fixedColumns:   {
      left: 3
    },

    columns: [

      { data: "Location" },

      { data: "A.dwgTag"},

      { data: "Status"},

      //{ data: "E.assetid" },

      { data: "higherlevel"},

      { data: "lowerlevel"},



      {data: "MSDPlanned",
        class: "toggle"

      },


      { data: "MSDForecast",
        class: "toggle"
      },

      { data: "MSDActual",
        class: "toggle"
      },


],


select: true,

//stateSave: true,   


buttons: [  ],


     //PAGINATION OPTIONS
    "pageLength": 250,
    "lengthMenu": [[50, 100, 250, 500, -1], [50, 100, 250, 500, "All"]],

  } );

  var permission = '<?php echo $role ?>';

  //console.log(permission);

  if (permission > 20) { 


    table.button().add(
      null, { extend: "edit", editor: editor },

    );

    table.button().add(
      null, { 

          extend: "columnsToggle", 
          columns: '.toggle',

      },
    );

    table.button().add(
      null, { extend: "excel" },
    );

  }


if (permission == 40) {         // Columns editable by SuperAdmin

    editor.enable(

        [
            'Location',
            'A.dwgTag',

        ]  );

}

else  {                         // Columns not editable by Users

    editor.disable(

        [
            'Location',
            'A.dwgTag',

        ]  );

}

} );

</script>
<?php require('../includes/fileend.php') ?>
Viewing all 82280 articles
Browse latest View live


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