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

NotInList event...

$
0
0

Hi all

Hope you are fine.

I'm back.... Some new project start.

I know Christmas is december 25, but .....

Does somebody know if there is a way to create "new value" event in a select

                    Field::inst( 'users.ID_service' )
                        ->options( extOptions::inst()
                            ->pre(array(array('value'=>'','label'=>''),array('value'=>'-1','label'=>'New value'))
                            ) 
                            ->table( 'services' )
                                ->value( 'ID' )
                                ->label('Name')
                        )
                        ->setFormatter( 'Format::ifEmpty', null ),
                    Field::inst( .......

In this sample if I select 'New value', I'd like to popup ask box, get the new value, write it in the table 'services' field 'Name' (used for label in select), get the ID of this new record, refresh the select content (or add this new value in) and select this value.

Writing this seem to be possible, but I'm not sur to be capable to create a pretty new method for select input, that can be called easily for each time needed, as (for sample)

                    Field::inst( 'users.ID_service' )
                        ->options( extOptions::inst()
                            ->pre(array(array('value'=>'','label'=>''))
                            ) 
                            ->allowAdd('LabelForAddNewValue') // or ....
                            ->table( 'services' )
                                ->value( 'ID' )
                                ->label('Name')
                        )
                        ->setFormatter( 'Format::ifEmpty', null ),
                    Field::inst( .......

Best regards


Library Version Checker utility

$
0
0

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

I have been searching unsuccessfully the forum and posts and inbox for a method to verify if I am running the latest version of the datatables libraries, with a view to keeping them updated regularly.

Can someone remind me the program,procedure available to perform this check, I believe Allan told me before but I am unable to find the conversation, sorry to ask again...

Also is it normal procedure to repeat the list of CSS, JS libraries at the top of each PHP file, or store common ones in a single library file referenced by each PHP file ?

Many thanks

Colin

Sort value for column different from displayed value

$
0
0

This may be a very common problem, but I did not find any relevant (and easy) solution so far:
I need to sort the rows of a table by a different value that the respective column shows.
Example:
* Value to be displayed: 11,85 m
* Value to be sorted by: 1185

If the sorting happens by the alphynumerical displayvalue, the sorting is wrong is it's interpreted as a string. So it should be sorted by the pure numeric integervalue in cm (which is available in my data).
In footable, there was an option to set an attribute "data-sort-value" which wouldl be used instead. Is there any similar (and simple, meaning no JS coding again) way to do this in DataTables?

Select2 dropdown list does not open after second editor openning

$
0
0

Hi

Have a series of select2 field in my editor form.
Everything works find when i open the editor for the first time. But after closing the editor form, and reoppenning it in create or edit mode, the dropdown field is clickable but nothing appear when clicking on it.
I will need to reload the page to get it working again.

{label: "Select type: ",name: "metadata_field_2",type: "select2",opts: {placeholder: "Select a content type",minimumResultsForSearch: 5,multiple: false,closeOnSelect: false,include_hidden: false}, options: generateTypeList(find_type('content[].type'))},

I upgraded from Select2 4.0.6 to 4.0.13 but not better.
I am using Editor 1.9.2

Any suggestions ?
Thanks in advance

Editor render is very slow when using many fields

$
0
0

I'm having an issue when my Editor can have 100-250 fields to display, the page load takes between 4-20 seconds. The issue seems to be the Editor.add() function which gets called iteratively in a linear fashion for each field to create the corresponding DOM elements. The performance graph below is for an Editor with 100 fields, and the time increases as the number of fields grows. We are using the fields property of the Editor initialization, which in turn is what calls add(). Our design requires the Editor to always be displayed, starting from page load, which is why this is an issue. Is there a way around this, for the Editor to load quicker or earlier somehow?

This link is the best I could do to create an example to show the problem. It's a dummy dataTable with 100 records, and presumably the 100 field Editor would display the slowdown when drawn, however the buttons aren't working in this setup which are necessary to open the Editor.

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

editor pre create function

$
0
0

i need to create new row in table called service, and return the id of this row, and set the value of this row in other field in other table called CruisesService

this is my code:

editor.PreCreate += (sender, e) => {
                    object value;
                    e.Values.TryGetValue("Service.Service_Name_Heb", out value);
                    var id = CreateService(Enums.ServiceType.CruisesService, (string)value);
                    editor.Field("CruisesService.CruisesService_id").SetValue(id);
                };

my question, is why precreate called even if there are error in validation?
what event i can used to make it happen clean without problem

Bootstrap tabs and simultaneous ajax

Server Side Processing - database ID search results only

$
0
0

Hi,

I have implemented datatables in a fairly basic manner setting the serverside processing to true. For reference, I followed this tutorial (mostly) as a guideline since I am using Laravel 7. https://fahmidasclassroom.com/laravel-7-crud-using-datatables/

For some reason, the serverside processing only looks at the database ID in the search. So if I type in the ID of the record then I will get results. But if I look for a string (like someones name) it doesnt return results.

Any pointers on what needs to be allowed to search those other fields? I tried setting the "searchable" to true explicitly but that had no effect.

Thanks!


Is it possible to add files to the XLSX package before it is downloaded?

$
0
0

I'm wondering if it is possible to add files to the XLSX package before it is downloaded.

How to validate if {data: 1} exists?

$
0
0

How can I validate if there is data in the json response?

example:

    'ajax': {
                'url':'serverside/show.materia.prima.php'
            },
            //"oSearch": {"sSearch": varsearch},

            "columns": [
                { data: "cod_piku" },
                { data: 1 }

            ],

I need to be able to ask if it exists, because in ajax,

I'm sending data: 1 if it meets a condition,

if not, then I only send cod_piku.

and it is necessary to validate if data: 1 comes because otherwise I have an error Cannot read property 'style' of undefined TypeError: Cannot read property 'style' of undefined

Пост N79 - Ставка на матч

$
0
0

Сохранить регистрационные данные в файл. Для сферы беттинга мы показываем очень умеренную доходность, потому что для нас важнее зарабатывать в долгую, так как мы несем ответственность за чужой капитал. Далее просто следуйте подсказкам системы, как инструкции, чтобы завершить процесс.

Данное решение позволяет иметь бесперебойный доступ к системе и обходить блокировки со стороны провайдера. Рассказать о мире спортивных ставок, беттинге поможет история.

А сейчас теперь большая конкуренция, чтобы попасть не только на основу но и вообще в сборную, где сделать ставки на футбол онлайн. Почему же все-таки онлайн букмекеры пользуются такой популярностью. Такие ставки рекомендуется использовать только опытным игрокам, ведь с большими выигрышами могут наблюдаться и серьезные проигрыши.
ставки на ставки live.
<a href="http://taupin.legtux.org/test/?paged=65&cat=1">Рабочее зеркало 1xbet</a> - здесь Вы найдете актуальную информацию
Такой вектор развития был в своё время выбран компанией, и рынок стран СНГ не является с их точки зрения перспективным для конторы. Где взять ссылку на рабочее зеркало 1ХБЕТ?

[b]Александр Попов Пловец. Олимпийские Игры. Биография, Инстаграм[/b]

Играть в букмекерской конторе вы научитесь с нашим учебником по ставкам на спорт для новичков. Именно тогда был проведен первый крупный турнир с призовым фондом в 1,6 миллионов долларов.

Прогноз ставок на футбол поможет игрокам получить не только оперативную, а и достоверную информацию о вариантах исхода футбольных поединков. Если вы пришли к нам, значит решили кардинально изменить подход к ставкам на спорт и перейти на новый уровень спортивной аналитики. Поскольку я имею достаточно богатый опыт игры, а также отличаюсь тем, что обожаю азарт рейтинг букмекеров нба прогноз, то у меня уже есть относительные знания насчет хорошего казино.

В интернете букмекерская контора Бет365 так же является неоспоримым лидером и принимает онлайн ставок больше любая из букмекерских контор старого и нового света. В таком случае риск минимальный, но нужно сначала определиться с планом игры (размер ставок, периодичность и т.д.) и ни в коем случае не отступать от него.

Change columnDefs and reload table

$
0
0

Hi :)

I would dynamicaly changes columnDefs (hide or not some columns), and reload the table.

I use Serverside mode so I can not post the script I tried of live, but tried to write for client side :
http://live.datatables.net/wulomita/3/edit

But it does nothing :(

Any idea of how could I do ?

Thanks :)

SearchPanes says no data

$
0
0

Hello,
I am currently switching to Datatables Editor and now I have the effect that the SearchPanes do not show any data.

Datatables: v1.10.22
SearchPane: v1.2.0
Select: 1.3.1

And here is the code:

require "../lib/DataTables.php";

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, 's_articles')
    ->field(
        Field::inst('s_articles_supplier.name'),
        Field::inst('s_articles_details.suppliernumber'),
        Field::inst('s_articles_details.ordernumber'),
        Field::inst('s_articles.name'),
        Field::inst('s_articles_details.stockmin'),
        Field::inst('s_articles_details.instock'),
        Field::inst('s_articles_attributes.attr7'),
        Field::inst('s_articles_attributes.attr6'),
        Field::inst('s_articles_attributes.lieferant')
    )

    ->leftJoin('s_articles_details', 's_articles.id', '=', 's_articles_details.articleID')
    ->leftJoin('s_articles_attributes', 's_articles_details.id', '=', 's_articles_attributes.articledetailsID')
    ->leftJoin('s_articles_supplier', 's_articles.supplierID', '=', 's_articles_supplier.id')
    ->process($_POST)
    ->json();
var editor;

$(document).ready(function () {
  editor = new $.fn.dataTable.Editor({
    ajax: "./pdo/db_inventory.php",
    table: "#inventory",
    fields: [
      {
        label: "Hersteller:",
        name: "s_articles_supplier.name",
      },
      {
        label: "Lieferant:",
        name: "s_articles_attributes.lieferant",
      },
      {
        label: "Hersteller-Nr:",
        name: "s_articles_details.suppliernumber",
      },
      {
        label: "Shop-Nr:",
        name: "s_articles_details.ordernumber",
      },
      {
        label: "Bezeichnung:",
        name: "s_articles.name",
      },
      {
        label: "Min.:",
        name: "s_articles_details.stockmin",
      },
      {
        label: "Lager:",
        name: "s_articles_details.instock",
        attr: {
          type: "number",
        },
      },
      {
        label: "Regal:",
        name: "s_articles_attributes.attr7",
      },
      {
        label: "Bemerkung:",
        name: "s_articles_attributes.attr6",
      },
    ],
  });

  $("#inventory").on("click", "tbody td.editable", function (e) {
    editor.bubble(
      this,
      [
        "s_articles_details.stockmin",
        "s_articles_details.instock",
        "s_articles_attributes.attr7",
        "s_articles_attributes.attr6",
      ],
      {
        title: "Ihre Eingabe:",
      }
    );
  });

  $("#inventory").DataTable({
    ajax: {
      url: "./pdo/db_inventory.php",
      type: "POST",
    },
    columns: [
      {
        data: "s_articles_supplier.name",
      },
      {
        data: "s_articles_attributes.lieferant",
      },
      {
        data: "s_articles_details.suppliernumber",
      },
      {
        data: "s_articles_details.ordernumber",
      },
      {
        data: "s_articles.name",
      },
      {
        data: "s_articles_details.stockmin",
        className: "editable",
      },
      {
        data: "s_articles_details.instock",
        className: "editable",
      },
      {
        data: "s_articles_attributes.attr7",
        className: "editable",
      },
      {
        data: "s_articles_attributes.attr6",
        className: "editable",
      },
    ],
    columnDefs: [
      {
        searchPanes: {
          show: true,
          layout: "column-2",
        },
        targets: [0, 2, 3],
      },
    ],

    responsive: true,
    dom: "Pfrtip",
    // '<"dtsp-verticalContainer"<"dtsp-verticalPanes"P><"dtsp-dataTable"frtip>>',
    serverSide: true,
    select: true,
    deferRender: true,
    language: {
      sEmptyTable: "Keine Daten in der Tabelle vorhanden",
      sInfo: "_START_ bis _END_ von _TOTAL_ Einträgen",
      sInfoEmpty: "0 bis 0 von 0 Einträgen",
      sInfoFiltered: "(gefiltert von _MAX_ Einträgen)",
      sInfoPostFix: "",
      sInfoThousands: ".",
      sLengthMenu: "_MENU_ Einträge anzeigen",
      sLoadingRecords: "Wird geladen...",
      sProcessing: "Bitte warten...",
      sSearch: "Globale Suche",
      sZeroRecords: "Keine Einträge vorhanden.",
      oPaginate: {
        sFirst: "Erste",
        sPrevious: "Zurück",
        sNext: "Nächste",
        sLast: "Letzte",
      },
      oAria: {
        sSortAscending: ": aktivieren, um Spalte aufsteigend zu sortieren",
        sSortDescending: ": aktivieren, um Spalte absteigend zu sortieren",
      },
      searchPanes: {
        emptyPanes: "There are no panes to display. :/",
      },
    },
  });
  $("#inventory").DataTable().searchPanes.rebuildPane();
});

Thanks

Lars

How to hide all columns except for some and export to excel

$
0
0

Hey guys, I have a service which brings about 150 columns, but I need just to show to the user 5 of them.
I know that I can use something like this to hide columns, but I would like to know if there is the opposite way to hide/show.

               columns: columns,
            "columnDefs": [{
                "targets": -1,
                "data": null,
            },
            {
            "targets": [3, 4],
            "visible": false,
                "searchable": false
        },
               dom: 'Bfrtip',
            buttons: [{
                      text: 'Export to Excel',
                          extend: 'excelHtml5',
                          className: 'btn btn-primary',
                          exportOptions: {
                            columns: ':visible:not(:last-child)'
                          }
                  } ]  

Can I somehow hide ALL 150 columns but only target 5 of them?
Also, I need to add the export to excel button which shows 150 columns, if I hide 145 of 150, will they appear
in the excel ??
THANKS.

DataTables : search and length field position mis-aligned

$
0
0

have been trying to position this properly, but need some help

i am using the following libraries

pdfmake 0.1.36, DataTables 1.10.22, Buttons 1.6.5, Column visibility 1.6.5, HTML5 export 1.6.5, Print view 1.6.5, Responsive 2.2.6

enter image description here

here is my code excerpts

var table = $('#datatable').DataTable({
            responsive: true,
            dom: 'Blfrtip',
          "buttons": [
            { extend: 'copyHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } },
            { extend: 'excelHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } },
            { extend: 'csvHtml5', 'footer': false, exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } },
            { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': false,
            exportOptions: { columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } },
            { extend: 'colvis', text: 'Columns'},
            ]
        });

The length and search is supposed to be in same line, but seems each is occupying full row.

Can someone point out what i am missing?


How to pass JSON API results from php to Datatables?

$
0
0

Hello for all,

I'm working with an API payment and i would like that Datatables loads these API results on table. In this case, i have one php Curl script that receive JSON results and display all these results on page. Below are the Curl script:

<?php

$token = "TOKEN_PROD";

$ch = curl_init('URL_API');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $token
   ));
$data = curl_exec($ch); 

$info = curl_getinfo($ch);

$decode = json_decode( $data, true);
    
foreach ( $decode["results"] as $value){
        echo 'Id:'.$value["id"].PHP_EOL.'<br>';
        echo 'Date.:'.$value["date_created"].PHP_EOL.'<br>';
        echo 'Type.:'.$value["payment_type_id"].PHP_EOL.'<br>';
        echo 'Amount:'.$value["transaction_details"]["total_paid_amount"].PHP_EOL.'<br>';
        echo PHP_EOL.'<br>';
    }

curl_close($ch);

?>

When i execute the php curl script above, all results from API display on page correctly and Json results from API, comes as below:

{
    "results": [
        {
            "metadata": {},
            "corporation_id": null,
            "operation_type": "regular_payment",
            "fee_details": [],
            "notification_url": null,
            "date_approved": null,
            "money_release_schema": null,
            "payer": {
                "first_name": "Test",
                "last_name": "Test",
                "email": "test_user_80507629@testuser.com",
                "identification": {
                    "number": "32659430",
                    "type": "DNI"
                },
                "phone": {
                    "area_code": "01",
                    "number": "1111-1111",
                    "extension": ""
                },
                "type": "registered",
                "entity_type": null,
                "id": "660118681"
            },
            "transaction_details": {
                "total_paid_amount": 10,
                "acquirer_reference": null,
                "installment_amount": 0,
                "financial_institution": "",
                "net_received_amount": 0,
                "overpaid_amount": 0,
                "payable_deferral_period": null,
                "payment_method_reference_id": "1229234987916",
                "verification_code": "1229982347916"
            },
            "statement_descriptor": null,
            "call_for_authorize_id": null,
            "installments": 1,
            "pos_id": null,
            "external_reference": null,
            "date_of_expiration": "2020-10-20T22:59:59.000-04:00",
            "charges_details": [],
            "id": 1229987916,
            "payment_type_id": "ticket",
            "barcode": {
                "content": "23791841400000010003323423480250122998791600633330"
            },
            "order": {
                "id": "1886191696336",
                "type": "mercadopago"
            },
            "counter_currency": null,
            "brand_id": null,
            "status_detail": "pending_waiting_payment",
            "differential_pricing_id": null,
            "additional_info": {
                "ip_address": "123.456.789.10",
                "nsu_processadora": null,
                "available_balance": null
            },
            "live_mode": false,
            "marketplace_owner": null,
            "card": {},
            "integrator_id": null,
            "status": "pending",
            "transaction_amount_refunded": 0,
            "transaction_amount": 10,
            "description": "Green Short",
            "money_release_date": null,
            "merchant_number": null,
            "refunds": [],
            "authorization_code": null,
            "captured": true,
            "collector_id": 582345463946,
            "merchant_account_id": null,
            "taxes_amount": 0,
            "date_last_updated": "2020-10-17T11:30:31.000-04:00",
            "coupon_amount": 0,
            "store_id": null,
            "date_created": "2020-10-17T11:30:31.000-04:00",
            "acquirer_reconciliation": [],
            "sponsor_id": null,
            "shipping_amount": 0,
            "issuer_id": null,
            "payment_method_id": "ticket",
            "binary_mode": false,
            "platform_id": null,
            "deduction_schema": null,
            "processing_mode": "aggregator",
            "currency_id": "USA",
            "shipping_cost": 0
        }
    ]
}

But if i want to display just some objects from json results above inside Datatable, i get an json error message from Datatable.

Below are the script on homepage that i'm using to populate Datatable:

<script>
    $(document).ready(function() {
    $('#example').DataTable({
        
    "ajax": 'api_payments.php',

  "columns": [
 { "data": "id" }
 { "data": "date_created" }
 { "data": "payment_type_id" }
 { "data": "total_paid_amount" }
  ]
        
    });
    });
    
    </script>

In this case, how can i improve my php script to display these json results inside datatables? Thanks :)

Decimal comma separator not working

$
0
0

Hi, I have something like these data in one column:
http://live.datatables.net/pasukibu/1/edit

When I try to search this "24,1" i think I would see 2 records. I don't see nothing. When i serahc "24.1" everything works great. In Polish we often use a numeric keyboard to wrte numbers and between Enter and 0 is our separator which is ",". What I do wrong?

Thanks for reply and have a nice day

Cannot add export button besides editor buttons

$
0
0

When using Datatables Editor plugin, I am trying to add the Export (excel, csv, etc) button besides the "New", "Edit" and "Delete" buttons. My original code:

new $.fn.dataTable.Buttons( table, [
        { extend: "create", editor: editor },
        { extend: "edit",   editor: editor },
        { extend: "remove", editor: editor }
    ]);
    table.buttons().container()
        .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
} );

I have tried to add the export button following a few examples, one of the latest being:

[
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor },
            {
                extend: "collection",
                text: 'Export',
                buttons: [
                    "copy",
                    "excel",
                    "csv",
                    "pdf",
                    "print"
                ]
            }
 ]

I have the following scripts included, which allow the export button:

     <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/buttons/1.6.4/js/dataTables.buttons.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.html5.min.js"></script>

What am I doing wrong??

Initialize data table with json columns

$
0
0

Hello

I am trying to use DataTables to build dynamic table based on JSON file which I have

My JSON file looks like this:

[
   {
      "ID":"1",
      "InvoiceNumber":"12344",
      "PagesCount":"3",
      "Status":"New"
   },
   {
      "ID":"2",
      "InvoiceNumber":"12345",
      "PagesCount":"6",
      "Status":"New"
   }
]

Have just 4 fields like record ID, InvoiceNumber, PagesCount, Status

Have HTML table like:

        <table id="jobs" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <td>ID</td>
                    <td>InvoiceNumber</td>
                    <td>PagesCount</td>
                    <td>Status</td>
                </tr>
            </thead>
        </table>

And a little JS code:

$(document).ready(function() {
    $('#jobs').DataTable( {
        "dom" : "<'row'<'small-6 columns dash-toolbar'><'small-6 columns'f>r>"+
                "t"+
                "<'row'<'small-6 columns'i><'small-6 columns'p>>",
        "lengthMenu": [ 15, 25, 50, 75, 100 ],
        "lengthChange": false,
        "ajax": '/dashboarddata?jobs=get_all'
    } );
} );

Could You please tell me why my json data is not loaded into the table?

Replace Value in Column with Value from Array

$
0
0

Hello,

I need some food for thought. I have a column with the ID of a supplier. I have the suppliers in an array, up to now I always retrieved this by $lieferant_array[$lieferantId]->value;. How can I implement this in the editor? Because the column now shows the ID and not the name from the array.

I hope I have expressed myself clearly.

Here is the link to the debug: https://debug.datatables.net/iqikad

Thanks

Lars

Viewing all 82206 articles
Browse latest View live