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

Clear [loadingRecords] message when exception happen

$
0
0

Hi everyone,

Currently I'm customizing the error message that pops up when some exception happen in the errorMode extension as code below:

$.fn.dataTable.ext.errMode = function (settings, helpPage, message) {
    Message.failMessage("My customized error message...");
};

But there is one thing I also would like to customize.
When loading data and an exception happen, the dataTable will show whatever is been set here

language: {
     loadingRecords: "Please wait - loading..."
}

and the dataTable keeps showing this message even after clicking on the popup.

My question is, how can I clean this message or give another message when an exception happen?

is there such a property like

language: {
     loadingRecordsError: "Sorry! Error loading data."
}

Thank you very much in advance guys!

Regards,
Alex


Child row vs colvis

$
0
0

I am using the 'colvis' button in my setup in combination with child rows.

I got the ideas on how to do that from https://datatables.net/examples/api/row_details.html and https://datatables.net/extensions/buttons/built-in.

I built a showcase for my problem on https://jsfiddle.net/L7xpkz3u/2/.

If you click on the "closed" cell, a child row should open up. By clicking on it again it should disappear. Now, if you were to use the "Column Visibility" button on top of the table, and click on a name of a column the column disappears where the content resides beside the table which does not happen if the child row was not activated during the session.

Does anyone know how to solve this problem?

Limit number of rows in the table

$
0
0

Hi guys, I need to create a condition or simply limitation when in my table has 10 records,
the idea is only allow 10 records no more.
do you have any idea?

thank you.

drag and drop between 2 tables

$
0
0

How to avoid page redirect to controller when drag and drop first to second datatable?

HOW CAN I DISTRIBUIT THE FIELDS AS FORM

$
0
0

Hi guys, I have a employe table, with several information, PASSPORT_ID, FULL NAME, PHONE NUMBER, ADDRESS, EMPLOYE ID, ETC ETC ETC, a lot information.

instead to have a table , i would like to have a form with all the information and for each page have information only for one employe.

any idea?

Like this

name: Last name: Bday:01/01/2000
Employe ID: Passport ID:
Address: Phone1: Phone2: Phone3:

Loading Datatables from JSON Problem

$
0
0

Hello,

I'm trying to take the following formatted JSON:

{
"status": "success",``
"data": {
"query": {
"numrows": 100,
"queryname=": "X_SR_OPEN_CLASSES",
"rows": [
{
"attr:rownumber": 1,
"STRM": "2203",
"CAMPUS": "CITY",
"SUBJECT": "BCAS",
"CATALOG_NBR": "  85",
"CRSE_DESCR": "Carpenter Apprentice I",
"CLASS_NBR": 27798,
"SEATS": "25",
"ROOM": "City-CLSRM",
"LOCATION": "Off Campus",
"START_DT": "2020-01-21",
"END_DT": "2020-06-01",
"EXPR29_29": "17:00",
"EXPR30_30": "18:25",
"EXPR31_31": "TTh",
"NAME": "SAMPLE, NAME",
"EMAIL_ADDR": "CSDEV92@erpdev.loc",
"EXPR19_19": ""
},

But when I load the tables I get a blank table, no error dialog pops up. Here's the javascript I'm using:

<script>
  $(document).ready(function() {
    $('#example').DataTable( {
      "processing": true,
      "ajax": {
        "url": "open_classes.json",
        "dataSrc": "rows",
      },
      "columns": [
        { "data": "STRM" },
        { "data": "SUBJECT" },
        { "data": "CATALOG_NBR" },
        { "data": "CRSE_DESCR" },
        { "data": "CLASS_NBR" }
      ]
    } );
  } );
</script>

Any assistance would be greatly appreciated.

Thank you.

replace value for any text

$
0
0

Hi, I have a table with field "Level" so in my data base this value is numeric
1 = BEGIN
2 = MEDIUM
3 = EXPERT

so, in my frontend, when the field = 1, show BEGIN, when 2 show MEDIUM, etc

thank you

How to make cell().data() persist to DB

$
0
0

Noob question here: once I've modified a cell's data with cell().data() how do I get it to 'post' that to the DB?

So... I've added a button (based on one of your examples) that re-populates my 'rowReorder' column with 1...n based on the current sort. This is so that I can initially sort my data maybe alphabetically by name, for example, then 'save' that sort in my rowReorder column, then start reordering again from there. (Order is relevant to a lot of our lists.)

The function is working great, but it's just not saving to the DB. Can anyone please help me add to below code so it saves?

buttons: [
    {
        text: 'Reorder',
        action: function (e, dt, node, config) {
            table.column(0, {search:'applied', order:'applied'}).nodes().each(function (cell, i) {
                table.cell(cell).data(i + 1).draw();
            });
        },
    },

Datatable with Row Grouping & Scrolling with Freezing Group Header

$
0
0

Do we have the feature that support Freezing the Row Group's header?

Search name with apostrophe inside mysql datatable.

$
0
0

Hi,
i'm using datatable plugin and works well except when i try to search records that contains apostrophs.
The problem is that the
$requestData['search']['value'])
doesn't pass the apostroph from the ajax function i have in the master file...

This is the code in the master page:


$(document).ready(function() { $.fn.dataTable.moment( 'DD/MM/YYYY'); $("#search").html($("#search").html().replace(/’/g, ''')); var dataTable = $('#<? echo $sezione; ?>-grid').DataTable( { language: { search: "Cerca" , "info": "Comuni in elenco: _TOTAL_", "sLengthMenu": "Mostra _MENU_ Comuni per pagina", paginate: { "next": "<i class='fas fa-arrow-alt-circle-right'></i>", "previous": "<i class='fas fa-arrow-alt-circle-left'></i>", } }, "processing": true, "serverSide": true, "stateSave": false, "searching": true, "ajax":{ url :"<? echo $sezione; ?>-grid-data.php", // json datasource type: "post", // method , by default get error: function(){ // error handling $(".<? echo $sezione; ?>-grid-error").html(""); $("#<? echo $sezione; ?>-grid").append('<tbody class="<? echo $sezione; ?>-grid-error"><tr><th colspan="3">Nessun dato presente.</th></tr></tbody>'); $("#<? echo $sezione; ?>-grid_processing").css("display","none"); } } } ); });

any help for me?
Thanks in advance

Datatable npm for buttons and select

One DT, 2 editor forms

$
0
0

Hi
The 1st editor form uses the standard create, edit and remove extensions but form #2 gets called from a custom button. DT and editor form #1 share the same Ajax method. Form #2 has a different Ajax method that should not refresh the DT as the data it handles is different background data the user can edit but not see directly via the DT. He needs to click the custom button to view and edit that data. The forms handle data across 2 different tables who share the same foreign key.

var editor2 = ModifyCustomerSubPackSNsAssociations_editor();

(DT code)

            buttons: [
                { extend: 'create', editor: editor1 },
                { extend: 'edit', editor: editor1 },
                { extend: 'remove', editor: editor1 },
                {
                    text: '@(lblo.lblAssociatedSNs)',
                    extend: 'edit', editor: editor2
                }
            ],

Code for ModifyCustomerSubPackSNsAssociations_editor:

    function ModifyCustomerSubPackSNsAssociations_editor() {

        var editor = new $.fn.dataTable.Editor({

            destroy: true,
            ajax: {
                url: '/CustomerSubsPacks/CRUDCustomerSubsPacksSNs/',
                data: function ( d ) {
                    return $.extend( {}, d, {
                        intContTpe: intContTpe1
                    } );
                },
                type: 'POST',
                async: true,
                cache: false
            },
            table: '#tblDataTable',
            fields: [
                {
                    label: '',
                    name: 'CustomerSubsPacksSNs.id'
                }, {
                    label: '@(lblo.lblServiceNumbers):',    //cdr formats and price lists don't show ticked when opening editor
                    name: 'CustomerSubsPacksSNs[].id',    //SNs
                    type: "checkbox"
                }
            ]
        });

        return editor;
    }

How do I reference editor2 correctly? The form opens but ajax method CRUDCustomerSubsPacksSNs never gets hit when form opens. Browser console does not throw any errors. Thanks.

Does not longer work with postgrsql for dotnet core : Npgsql 3.x removed support for ...

$
0
0

I am using DataTable.net editor for dotnet core with postgrsql

Npgsql 3.x removed support for writing a parameter with an IEnumerable value, use .ToList()/.ToArray() instead

배운 oepa.or.kr/theking/ - 더킹카지노

$
0
0

[몰락한 전사귀족에게 배운 https://oepa.or.kr/theking/ - 더킹카지노적이 퍼스트카지노있습니다만, 샌즈카지노아직 코인카지노제대로 더나인카지노써먹지 우리카지노못하
고 있습니다. 전사만을 위한 검이 아닌, 세상을 위한 검을 써보고 싶지만
불행히도 기회를 만나지 못했습지요.]

DataTable Edior issue with postgrsql

$
0
0

Hi
I postgrsql you got catalogs named like public and you can even create you own catalog in postgrsql
to navigate to a catalog in postgrsql u need to use . then table name or sp or function.
when i trying insert to a table name products in catalog pj i type pj.products i even try move the table to public and type public.products when it try doing a insert it will not report any problem or doing any modifcation or insert of data.


Issues to Export data to Excel

$
0
0

Hello everybody!

I'm newbie in datatables API and I'm found some issues to export data for Excel. The fist issue is that I need to whart text in same cell. for this topic I found a alternative solution passing the information as formula. The problem is I need to replace = to = to excel understand that I'm working with formulas and a I need to active the option in excel to wrap text in excel.

I tried to look in others topics but I didn't found a solution...

Below you can check my javascript code:

 $(document).ready(function () {
        $('#datatable').DataTable({
            keys: true,
            dom: 'Bfrtip',
            lengthMenu: [
            [10, 25, 50, -1],
            ['10 rows', '25 rows', '50 rows', 'Show all']
            ],
            buttons: ['pageLength',
                {
                    extend: 'excelHtml5',
                    autoFilter: true,
                    text: 'Export to Excel',
                    title: 'Pré Configurador',
                    exportOptions: {
                        format: {
                            body: function (data, row, column, node) {
                                //if it is html, return the text of the html instead of html
                                data = "=\"" + data.replace(/<br>/g, "\"&CARACTUNICODE(10)&\"") + "\""
                                data = remove_tags(data);
                                $(this).attr('s', '55');
                                return data;
                            }
                        }
                    }
                }
            ]
        });
        });

Could you please helo me?

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

On Editor entry form, how do I allow a null input?

$
0
0

Code below. for min_amount and max_amount fields, I would like to be able to enter new data or edit data with the option of putting in a number or leaving the field blank or null value.

        {% include "dt_csrf.html" %}

        $('#opex').DataTable(
        );
        $('#otherexp').DataTable(
        );

        let bldg = {{ bldg.id}};
        console.log("bldg" + " " + bldg);

        let editor = new $.fn.dataTable.Editor({
            ajax: "/api/exptiedrev/editor/?format=datatables",
            table: "#exp",
            fields: [
                {
                    label: "Name",
                    name: "name"
                },
                {
                    label: "Type",
                    name: "exp_type",
                    type: "select",
                    options: [
                        {label: "Operating Expense", value: "Operating Expense"},
                        {label: "Other Expenses", value: "Other Expenses"}
                    ],
                    def: "Operating Expense"
                },
                {
                    label: "Revenue Type",
                    name: "rev_type",
                    type: "select",
                    options: [
                        {label: "Base Rent", value: "Base Rent"},
                        {label: "Gross Rent", value: "Gross Rent"}
                    ],
                    def: "Base Rent"
                },
                {
                    label: "Charge Rate %",
                    name: "charge_rate"
                },
                {
                    label: "Min, Charge $",
                    name: "min_amount"
                },
                {
                    label: "Maximum Charge $",
                    name: "max_aumount"
                },

            ],
        });

        editor.on('preSubmit', function (e, data, action) {
            if (action === 'create') {
                data.data[0]['bldg'] = parseInt(bldg);
            }
        });

        // Activate an inline edit on click of a table cell
        $('#exp').on('click', 'tbody td ', function (e) {
            editor.inline(this);
        });

        let table_rev_exp = $('#exp').DataTable({
            "serverSide": true,
            dom: "Bfrtip",
            "ajax": "/api/exptiedrev/?format=datatables&bldg=" + bldg,
            "columns": [
                {"data": "bldg"},
                {"data": "name"},
                {"data": "exp_type"},
                {"data": "rev_type"},
                {
                    "data": "charge_rate",
                    "render": function (data, type, row) {
                        return data + "%";
                    }
                },
                {"data": "min_amount", render: $.fn.dataTable.render.number(',', '.', 2, '$')},
                {"data": "max_amount", render: $.fn.dataTable.render.number(',', '.', 2, '$')},
            ],
            select: true,
            buttons: [
                {extend: "create", editor: editor},
                {extend: "edit", editor: editor},
                {extend: "remove", editor: editor},
                {
                    extend: 'collection',
                    text: 'Export',
                    buttons: [
                        {
                            extend: 'excelHtml5',
                            customize: function (xlsx) {
                                $(xlsx.xl["styles.xml"]).find('numFmt[numFmtId="164"]').attr('formatCode',
                                    '[$$-45C] #,##0.00_-');
                            },
                            exportOptions: {
                                columns: [1, 2, 3, 4, 5, 6],
                            },
                            title: "Expenses"

                        },
                        {
                            extend: 'pdfHtml5',
                            exportOptions: {
                                columns: [1, 2, 3, 4, 5, 6]
                            },
                            title: "Expenses"
                        },
                        {
                            extend: 'print',
                            exportOptions: {
                                columns: [1, 2, 3, 4, 5, 6]
                            },
                            title: " Expenses"
                        },
                    ]
                },
            ],
            "columnDefs": [
                {
                    "targets": [0],
                    "visible": false,
                    "searchable": false
                }
            ],
        });

        table_rev_exp.buttons().container()
            .appendTo($('.col-md-6:eq(0)', table_rev_exp.table().container()));

    });

No Effect for Multi Filter Search Columns for Deactivated Colums by Default

$
0
0

Hi all,

I need a last one features. Hope so. Unfortunately I cannot show it by fiddle, because the important part of the code, which is fine on my localhost destroys the table in fiddle. It's that "columnDefs" part, which is deactivated in fiddle. But this is the part my question deals with. https://jsfiddle.net/RoloTomasi/uqyrbv8h/23/

So the actual question is this one.
I'm able to deactivate the colums 11-21 as default. If someone wishes information e.g. for "Erzielte Tore pro Spiel", she should fade in the columns by using "Spalten ein/ausblenden". But with execution of this button only the colums are diplayed, the filter in the second row, doesn't have any effect.

Is there a poosibility to make them active like the other search columns?
Thanks in advance,
Rolo

seachPanes: Show pane by column name, not ordinal position

$
0
0

Hi

I created a test case to demonstrate my problem but there is a script error so I can't show my issue. Test case is here live.datatables.net/kupizova/1/edit

All I want to do is show and hide panes based on their name, not the column position in the table. This is because the user can reOrder columns.

In my real world project, the searchPanes are ok and displayed in either a modal or a sidebar (user choice) but some panes like a telephone number or email address do not and should not be available for filtering because there would only ever be one. By rights, it should automatically be excluded from the panes because of the uniqueness.

If you were to apply this: -

$(document).ready(function() {
    $('#example').DataTable( {
        searchPanes:true,
        dom: 'Pfrtip',
        columnDefs:[
            {
                searchPanes:{
                    show: true,
                },
                targets: [0],
            },
            {
                searchPanes:{
                    show: false,
                },
                targets: [2],
            }
        ]
    });
});

Then pane 2 would not be shown

I want to replace targets: [2] with `targets: ['name:telephone', 'name:email']'

Is this possible?

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

DataTables pagination links to incorrect URL

$
0
0

Hey guys,

I have a little problem with datatables on my blazor site.
I´ve pagination enabled, but when I want to change the site my browser opens the url cause datatables does not recognize the correct url.

The correct url was: https://localhost:44314/exec/state/3 but datatables thinks that its https://localhost:44314/#. Cause its not the root site, my browser loads the root site instead of changing the page.

Is there anything special, which I must look for?

My datatable config looks like this:

    $(table).DataTable({
        "paging": true,
        "lengthChange": true,
        "searching": false,
        "ordering": true,
        "info": false,
        "autoWidth": false,
        "scrollX": true,
        "scrollY": true,
    });

Thanks for anyone who can help!

Best regards,
Robert

Viewing all 81691 articles
Browse latest View live


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