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

FixedHeader too wide when fixed

$
0
0

Hello,

I have the FixedHeader working here http://clb0212.wpengine.com/publications/ on a public test site.

When I scroll down, it is a correct fixed header, but the header size is twice as wide as it should be. What am I doing wrong?

thanks!
Christina Black


I'm hardcode to all width for search input but does'nt work

$
0
0

This is code i use

<style>
.dataTables_info,
.dataTables_length {
font-size: 15px;
}

.dataTables_filter input {
    width: 400px;
}

.dataTables_wrapper {
    font-size: 15px;
}

<style>

all css working only .dataTables_filter input not working well

Images

how to left align all the rows data when export in PDF with limited columns.

$
0
0

exportOptions: {
columns: [ 0, 1, 2, 3 ]
},

Laravel: Undefined property: stdClass::$id

$
0
0

Hey,

I get an error when using DataTables in Laravel.
The error:
Undefined property: stdClass::$id

But I am getting an id from my database.

Appending Buttons to existing dropdown

$
0
0

Hi.

I would like to append the contents of export Buttons menu to an existing dropdown on the page.

Current code:

 var exportBtn = new $.fn.dataTable.Buttons(table, {
        buttons: [{
            extend: 'collection',
            text: '<i class="mdi mdi-dots-horizontal mdi-icons-table"></i>',
            className: 'btn-fw-grey border-0 with-data-toggle',
            buttons: [{
                    text: '<div class="pt-3" style="text-transform: uppercase">exportieren</div>'
                },
                {
                    extend: 'copy',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>Kopieren</a>',

                },
                {
                    extend: 'pdf',
                    orientation: 'landscape',
                    pageSize: 'LEGAL',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>PDF</a>'
                },

                {
                    extend: 'excel',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>Excel</a>'
                }
            ]
        }]
    });

    exportBtn.container().appendTo(filterColumn);

Which comfortably places the export Buttons menu at a default position relative to the table.

What I would like now is something like:

    if(options.buttonsAt) exportBtn.ACTUAL_BUTTONS().appendTo($(options.buttonsAt));  // I'd like a call like this.
    else exportBtn.container().appendTo(filterColumn);

Can I get hold of the actual buttons as opposed to the dropdown toggle?
Or is there another solution to achieve the effect?

SearchPane - feedback

$
0
0

This thread is for feedback of the SearchPane blog post.

SearchPane is currently "experimental", in the sense that it hasn't been released as a full extension for DataTables and all that entails, as I would like to get some early feedback on the software. Is it useful? What is it missing? I'll maintain a list of requests in this post so we don't end up with too many duplicates.

Regards,
Allan

Feature list

  • Full support for Bootstrap, Foundation, Semantic UI, etc.
  • Server-side processing support (loading data from the server-side)
  • Have the count show two numbers - the first would be how many remain in the filtered set and the second would be how many in the table overall.
  • Ordering of data to match the DataTable
  • Search the search pane!
  • Rebuild API method for selected columns
  • Collapsible container
  • Support for array based data
  • Interfacing with the global search (difficult?)
  • Selection options similar to Select (e.g. os and multi, etc.)
  • Option to match column visibility (with or without Responsive?)

Add own buttons to editor with own function?

$
0
0

Good morning

So I am in the final week to present internally the new ordering system based on datatables with editor...

For enhancing the user experience I would like to know if it is possible to add to the existing editor buttons (new, edit, delete) my own buttons which trigger some action...

Also would be great if I can enable a button only if a row is selected, like for edit and delete...

thanks in advance
richard

Editor: Add new line in inline edit mode

$
0
0

Good morning

Is it possible to add a new row without the dialog but instead it adds just an empty row for inline editing?

This would greatly enhance the user experience as well...

thanks in advance
richard


Landscape Option Not Showing in Google Chrome Print Preview Options

$
0
0

Hi,

I am using datatables on laravel project. When i use print button or ctrl+p, landscape option not showing google chrome print preview. How can i show this option?

Thanks.

check width of cells once table is loaded

$
0
0

I'm trying to measure the width of cells in fnDrawCallback .

docstable.DataTable().column(3).nodes().each(function (cell, i) {

console.log('$cell -----> ',cell);

}

the above code lets me know that i have located the correct cells

$(cell).addClass('test')

assures me that i am able to manipulate the DOM with this function

console.log('$cell -----> ',cell.offsetWidth);

returns a values of 0

i'm trying to find out which cells would be expanded beyond their default width. Those which would be are to have the css class added which contains overflow:ellipses. but without the measurements its impossible to do this calculation

Uncaught TypeError: Cannot read property 'style' of null

$
0
0

This is the js image that I wrote

This is the html image that I wrote


I checked before asking, I found that the answer in the forum the number of columns <th> in html is not equal to the data
Hope you help. Thank you...

Language and back to top

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?

AutoWidth - prefer last column

$
0
0

Hey,
I'm happy with the autoWidth feature and I also know, how to set specified width for a column.

My problem is, that I want to autoWidth the last column. Sometimes, the data in the table is to much and the autoWidth for the first X columns is correct. Then, the last column has not enough space and line breaks the data.
But I want to autoWidth the last column and it's better to line breaks the first column.

Is it possible to do this? I didn't find any solution. I don't want to set a fixed width for the last column, because I don't know the possible width for the last column, because data can change.

Hope, somebody has a solution for this.

Trying basic table example in html but table disappears

$
0
0

Hi all,
So I have an html page with a table in the header. Further down I'm using the example presented in the datatable main page. When I load the page, my table displays for about half a second, then it disappears... everything else displays ok... can anybody help? here's my code for that particular section...

<!-- Start of loads page -->
<div data-role="page" id="loads">

    <div data-role="header">
    <a href="#main" data-transition="slide" data-direction="reverse" class="ui-btn"><</a>
        <h1>Loads</h1>
    </div><!-- /header -->


    <div role="main" class="ui-content">

    <p>This Text is above the table...</p>
    <p>
    <script type="text/javascript">
    $(document).ready(function() {
    $('#table-loads').DataTable();
    } );
</script></p>
<p>This is below the table...</p>

    </div><!-- /content -->


    <div data-role="footer" data-position="fixed">
        <h4></h4>
    </div><!-- /footer -->
</div><!-- /page -->

MDC for Web + Datatables

$
0
0

Hi,
will be supported MDC for web instead of MDL as this is outdated and no more updated by Google, since they are focusing on this lib.
Thanks

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()));

    });

Select field from another table

$
0
0

Good evening! I've read a lot about DataTable in recent days. I studied all the examples.
I see that there are many opportunities. On the other hand, for me-a beginner, a lot of difficulties. Please help me. I'm trying to move gradually, but I'm a little confused. I would like to solve this problem:
There are two tables:

--- Table 1 «Countries» ---
Field «id»
Field «Name_Country»

--- Table 2 " Users» ---
Field "id_Country»
Field "Name_User»

In the browser, you need to display Table 2 "Users", but instead of the "id_Country" field, put the values of the "Name_Country" field in Table 1 "Countries".
For example:
USA Boris
Poland Elisa

And in the editor, I would like the first field - SELECT based on the values of the "Name_Country" field from Table 1 "Countries". But, of course, the corresponding value of the "id" field from this Table should be substituted in Table 2 "Users".

autoComplete plugin

$
0
0

Good afternoon

Can it be that on the trial version I can't test the autoComplete function in the add new row dialog?
Or did I missed to include the according JS file?

thanks in advance
richard

How to change date format ?

$
0
0

Hello,

I am facing an issue concerning the date format within datatable.
I would like to display the data using the format "YYYY-MM-DD" (without hours, minutes and seconds).
Following the example given on this page: https://editor.datatables.net/examples/dates/formatting.html , I used the plug-in Moment.js in order to do it.
It works correctly for the input: when I enter a new data, the form displays the correct format.
Also, when I validate the new entry, the date is displayed using the wanted format.
However, once I refresh the page, the data is displayed in the default ISO 8601 format.
I have searched in the site and forum, but I did not succeed to fix this issue.
Have you got an idea of what I have made wrongly?
Thanks !

Viewing all 81691 articles
Browse latest View live


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