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

Error Datatble

$
0
0

Hello, I have a question, datatable does not work in code, it only does it in the browser console, not at the time of loading, why is that error?


Resizing a column affects getting the datatable. It shows no records/shows old results

$
0
0

Hello All,

I have come across a weird issue, rather couple of issues and these are tied up to resizing the column manually.

I have json array data coming from an ajax call. I have set the datatable to destroy before each call in order to show the data for each dataset that is coming back from the ajax call for new criteria that is sent.

The table is rendered looks good.

The issue is happening when the user resizes the column. The moment the column is resized, it shows no records but the message set for the language.emptyTable property. However, it shows the page numbers and when I click a page, it shows records from the previous result set.

However, at this point, I tried using .clear() along with .destroy() and this clears up showing the old results.

But the issue remains that when I resize the column, it shows no records + message set for language.emptyTable + page numbers for the current result set.

Can somebody throw some light on this on what possibly could be causing this issue.

Other info:
datatables v1.10.18
jquery v1.11.3
jqueryui v1.12.1
Buttons v1.6.1

Thanks.
Uresh

Editor inside another editor's modal?

$
0
0

I have a datatables that uses editor with custom template for editor modal. In that template I have another datatables with editor as well. All works fine technically. Except, and I'm guessing because I'm already inside of a modal. Second editor can not use modal anymore, if I set it for inline editing it works fine. But then I can not use options that do use modal, like create or remove. Any ideas? Thank you.

Export 2 DataTables to the same PDF one below the Other

$
0
0

I have 2 dataTables on the same Web Page. I have completely customised my dataTables in the Export. But there is 1 task I am still struggling to accomplish. Given that the tables are once below the other their own DIV tags, How would I be able to export these two in a PDF one below the other with a page Break in between them. Any help regarding this would be greatly appreciated. Thanks! Great API!

why the table does not display data that comes from the server?

$
0
0

My test case is:http://montaj.vianor-konakovo.ru/orders.html?id=16.If you select a row with code 100 in the first column in the first table, the server will return 2 rows for the second table, but they are not displayed and an error occurs. Explain what the problem is. What do I need to change for the program to work correctly?

Executing IQueryable list server side with Entity Framework

$
0
0

This extension provides you to execute Datatable js request on Entity Framework IQueryable queries.
With "ToDataResult(request)" extension function, data can get with server side pagination very simply.

public JsonResult GetDataResult(DataRequest request)
    {
        DataResult result = context.People.ToDataResult(request);
        return Json(result);
    }

Install the package and use it;

$ Install-Package EFDatatable.Data -Version 1.1.0

If you have MVC project you can also use this helper

Javascript event handlers question

$
0
0

I'm trying to use a javascript onchange() event handler on my Editor fields. Specifically, numeric fields so that I can check that the values meet certain criteria. The field definition looks like this:

{label: 'W2', name: 'W2_Amount', id: 'W2_Amount', type: 'text', attr:{onchange:'myChange(this)',classname:'numericField2',type:'number',maxlength:13, min:'0', max:'99999999', step:'0.01'} }

The onchange() event handler executes when the field value changes, which is what I want, but it also executes when the Editor page first displays for every field that has an onchange() event handler, which is what I don't want. My guess is that the initial page load's values go from uninitialized to a value, triggering the event handler for each field, when the page loads. Is there a way to bypass the initial triggering on a page load? Or should I be handling event handlers a different way?

Is it possible to use a php varible instead of null here "->setFormatter( Format::ifEmpty( null ) )"

$
0
0

Hi
What I want is to set a standard value when creating a new post in DataTables. I know that I could just write this value here:
->setFormatter( Format::ifEmpty( 1924 ) )
but I want the standard value to be editable in my page for standards or defaults. So I have a PHP varible called $faktor, that I want the setFormatter to take insted of null. Is that possible?
->setFormatter( Format::ifEmpty( $faktor) ) doesn't work.
Any ideas?
Best regards
Claus


datatable data recovery

$
0
0

Hi, I'm a beginner so tried to understand myself.
I have a datatable with data I would like to recover all of them and save them in my comic strip when I press on pon button to validate with jquery.

$(document).ready(function() { $("#btn").click(function() { var data = mytabe.rows().data(); $.post("<?php echo base_url()?>pointage/SavePointage", { idagent: $("#idagent").val(), datejr: $("#datejr").val(), heurdebut: $("#heurdebut").val(), heurefin: $("#heurefin").val(), observation: $("#observation").val() }, function(data, status) { alert("Data: " + data + "\nStatus: " + status); }); }); });

<

div class="data-table-area mg-b-15">

enregistrer
<?php if(isset($getall)):?> <?php foreach($getall as $getel): ?> id; ?>" /> id; ?>" /> <?php endforeach;?> <?php else: ?> <?php endif;?>
Matricule Prénom et Nom Date Présence Heure D'arrivée Heure Départ Observation Action
<?php echo $getel->matricule?> <?php echo $getel->nom?> <?php echo $getel->prenom?> " readonly />
Pas d'enregistrement ...

Editor Error - Cannot read property 'oFeatures' of undefined

$
0
0

I am trying to use editor on datatable but whenever I pass the table option to the editor variable (which I must), it gives me errors upon clicking CREATE, EDIT or DELETE. I know the editor is loaded correct because when I remove the table option it works, albeit disconnected from the dataTable. Below is my code:

<table id="table">
    <thead>
        <tr>
            <th>id</th>
            <th>First name</th>
            <th>Last name</th>

        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

<script>

    var editor = new $.fn.dataTable.Editor( {
        table: "#table",
        ajax:  '/api/staff',
    
        fields: [
            { label: 'First name', name: 'first_name' },
            { label: 'Last name',  name: 'last_name'  }
            ]
    });

    $('#table').DataTable( {
        ajax: {
             processing: true,
             url: "{% url 'business_process_json' %}",
             dataSrc: ""
         },
        dom: 'Bfrtip',
        columns: [
            { data: "pk" },
            { data: "fields.first_name" },
            { data: "fields.last_name" },
        ],
        buttons: [{
            extend: 'create',
            editor: editor
        },{
            extend: 'edit',
            editor: editor
        },{
            extend: 'remove',
            editor: editor
        },{
            extend: 'collection',
            text: 'Export',
            buttons: [
                'copy',
                'excel',
                'csv',
                'pdf',
            ]
        }
        ],
        select: true
    } );

</script>

HTML-sourced data with group row not supported?!?!

$
0
0

I'm working on an integration with this plugin, with a library that's pretty much requiring me to manually render the table.

When I pass it the following table :

<table id="report-table-vEWLZKrBJ6" class="report-table" style="width: 100%;">
    <thead>
        <tr>
            <th>Store</th>
            <th>Cash Sales</th>
            <th>Credit Sales</th>
            <th>Tips</th>
            <th>Gross Sales</th>
            <th>Discounts</th>
            <th>Credits Issued</th>
            <th>Credit Card Total</th>
            <th>Tax</th>
            <th>Net Sales</th>
        </tr>
      </thead>
      <tbody>
        <tr role=row>
          <th 
              role=row
              colspan=10
              >2020-01-16</th>
        </tr>
        <tr role="row">
          <td>Broad Ripple #1 (1)</td>
          <td>$10.26</td>
          <td>$0.00</td>
          <td>$0.00</td>
          <td>$10.26</td>
          <td>$0.00</td>
          <td>$0.00</td>
          <td>$0.00</td>
          <td>$0.77</td>
          <td>$9.49</td>
          
        </tr>
        
  </tbody>
  <tfoot>
    <tr>
      <th>Total records : 1</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      
    </tr>
    
  </tfoot>
  
</table>

and say

$(`#report-table-vEWLZKrBJ6`).DataTable()

I'm greeted with the following cryptic error:

Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined

After some banging my head against the code, I found it was the group header row that is causing the issue. But WHY?!?
For some reason, filling that grouping header row with empty <th>s and removing the colspan fixes the issue.

Again, WHY!?

CodePen is available here: https://codepen.io/mwarren/pen/GRgYvqx?editors=1010

light gallery feature disappears after using search, sort and next page in datatable

$
0
0

Hi guys, I've recently dabbled in implementing a datatable into my website. (this is the first website I've ever worked on, so it's a template I've bought and redesigned.)
So I have recently made a table with a lot of 'disciplines' from a game called Crowfall.
It can be seen here: https://vanguardcrowfall.com/disciplines

My problem is, if you try and click on the images in the table, the images on the first page will pop up and show up like in the light gallery as they should.

But if you use the sort function, search function or go to next page in the table, the pictures from clicking on the icons, won't act as if they were in the light gallery.

And I would like all the icons to work like they work on the first page of the table.

Hoping someone could help with this.

Multiple DataTables with seperate Custom filter for each table on same page

$
0
0

Hi,
I have 2 tables in same page, let say

$('#report-table1').DataTable();
$('#report-table2').DataTable();

No I want to add custom filter for each datatable using

$.fn.dataTable.ext.search.push(
    function( settings, data, dataIndex ) {
       
    }
);

but above filter works only for one table. How to add different filter function for each datatables in same page. Please help me. Thanks in advance

Change Align Export Title, Top Message and Bottom Message

$
0
0

How do I change align and font style for export title, top message and bottom message? The export title, top message and bottom message keep show in center when I export Excel or PDF file. Here is my code.

buttons: [
       {
              "extend": 'excelHtml5',
              "className": 'btn btn-table-excel',
              "init": function( api, node, config) {
                        $(node).removeClass('dt-button')
              },
              "title": exportTitle,
              "messageTop": exportMessageTop,
              "messageBottom": exportMessageBottom
       }, {
              "extend": 'pdfHtml5',
              "className": 'btn btn-table-pdf',
              "init": function( api, node, config) {
                       $(node).removeClass('dt-button')
              },
              "title": exportTitle,
              "messageTop": exportMessageTop,
              "messageBottom": exportMessageBottom
       }
],

My DataTables version is 1.10.13 and my DataTables Buttons version is 1.6.1

Sort datatables rows by it's json values

$
0
0

Hi!
I'm sorting my datatable by individual buttons (ascending/desceding) and I want to sort it by row data unused in table.

Every button click, I'm getting whole table data, sorting it and reinitialising whole table and it's working perfectly, but after reinitialise I'm losing all previous table filters/selected rows etc which is really annoying.

So my goal is to sort table by nested row data using these buttons WITHOUT destroying/initialising datatable.

Is there any other way to make it "on the fly"?

There is my code with reinitialising: http://live.datatables.net/vufuwali/1/edit?html,js,output


Is is possible to have only specific columns displayed in responsive mode?

$
0
0

My thought here is to keep a consistent UI and have the tables collapse an leave only the first column in responsive mode regardless of the width - i.e. as soon as the responsive mode is triggered you only get the one column.

Can you do that?

ext.search.push not working with serverSide

$
0
0

Yesterday I noticed that filtering with ext.search.push does not work with serverSide data tables. I knew that the usual search doesn't work with serverSide tables because the search is performed on the server and not on the client. So any transformation of data base values on the server side creates a problem. Got used to that.

But I don't think it would be required for serverSide data tables that ext.search.push on the client side is turned off as well.
Can you turn it on for this please.
I mean it is optional anyway, so why turn it off for serverSide? Anyone who thinks this will impair performance doesn't have to use it.

Here is my use case:
I use the more or less same data table once with serverSide and once without serverSide for different purposes. ServerSide is needed to perform a full-text search on large documents that the user can upload and which are OCR-transformed with Tesseract if they aren't machine readable and then parsed to allow full-text search in all of the uploaded documents.

In both cases I have a custom button (not a data tables custom button) for the user to set whether she wants to see expired contracts or not and how long they may have been expired. The filtering is done with ext.search.push like this:

$.fn.dataTable.ext.search.push(
    function (settings, data, dataIndex, row, counter) {
        if (typeof row.ctr !== 'undefined') {            
            if (row.ctr.expired > '0') {
                return filterShowNMonths(row.ctr.end_date);
            }
        }
        return true;
    }
);

With the help of the debugger I found out that this logic isn't executed for serverSide data tables. Would be great if this could change.
This is my work around for serverSide:

ajax: {
    url: 'actions.php?action=tblCtrManagement',
    type: 'POST',
    data: function ( d ) {   
        if ( serverSide ) {
            d.startDateExpired = nMonthsAgo( $('#monthsSelect').val() );
        }
    }
},
->where( function ( $q ) {
    if ( isset($_POST['startDateExpired']) ) {
        $q  ->where( function ( $r ) { 
            $r  ->where( 'ctr.expired', 0 )
                ->or_where( function ( $s ) { 
                    $s  ->where( 'ctr.expired', 1 )
                        ->where( 'ctr.end_date', $_POST['startDateExpired'] . ' 00:00:00', '>='); 
                } );
        } );
    }
} )               

Limit number of pages in pagination

$
0
0

Is it possible to set the max number of pages displayed in the pagination? It is needed for the case when the actual number of pages is too huge and requesting data for last pages may impact server performance (MySQL is known to be pretty slow when it comes to pagination with big offsets, and, for instance, Elasticsearch will throw an error when requesting data with offset > 10000). So it would be great to have the ability to show the real number of records (Showing 1 to 100 of 97,859 entries) but show only first N pages in the pagination control.

wrong header when exporting pdf when using yadcf filter

$
0
0


wrong header when exporting pdf when using yadcf filter.
how can i fixed and not show values in header

Add radio buttons filters

$
0
0

Hi,
Can I add radio buttons on top of the table that act as filters?

I have a table with a "destinations" column, that contains a list of cities. And I want the user to be able to filter the list depending on the cities they're interested in so they can plan their itineraries. So I'd need a bunch of radio buttons.

I'm using Tablepress on Wordpress.
How can I achieve this?
Thanks!

Viewing all 81908 articles
Browse latest View live


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