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

Index column and deferRender

$
0
0

I have a table where I would like to add a column where the user could see row indexes, like in this example. The problem is that the table has quite a bit of rows and expected to be accessed from mobile so, as one would expect, I'd like to have it loading as fast as it's possible. One of ways to make it faster is to use deferRender option which really improves loading speed but it's not compatible with the code for index column because it generates IDs only for first page.

So, I was wondering if there is some other lightweight approach to add that column while keeping deferRender on. My guess would be to utilize column render mechanics but I can't find a way yet to access indexes of rendered rows from there.


Where's gone the records quantity selector?

$
0
0

Hi, everyone. In the examples in datatables site, when you use the editor buttons (New, Edit, Delete) the selector for number of records is missed, so I can't choose to see 10, 15, 25...etc records. No example in the site shows the edit buttons together to number of records selector. Can they both appear on the page simoultanously?
Thanks, Allan.

Problems with Bubble Editor

$
0
0

Having a two problems with the bubble editor in Bootstrap.

  1. The input and button are not lined up, the button is display a little below the line of the editor (not a different line).
  2. For the readonly field, input field is inactive but the Update button is still active!

For 1, it seems the bubble editor is not using the form-inline class, which is designed for such alignments (per Firefox inspect feature).

how to use File export and Language setting together

$
0
0

hey guys i need your help
im new to DataTables
i have a qustion how to use File export and Language setting together
i have this code

$(document).ready(function() {
    $('#example').DataTable( {
        "language": {
    "processing":   "מעבד...",
    "lengthMenu":   "הצג _MENU_ פריטים",
    "zeroRecords":  "לא נמצאו רשומות מתאימות",
    "emptyTable":   "לא נמצאו רשומות מתאימות",
    "info": "_START_ עד _END_ מתוך _TOTAL_ רשומות" ,
    "infoEmpty":    "0 עד 0 מתוך 0 רשומות",
    "infoFiltered": "(מסונן מסך _MAX_  רשומות)",
    "infoPostFix":  "",
    "search":       "חפש:",
    "url":          "",
    "paginate": {
        "first":    "ראשון",
        "previous": "הקודם",
        "next":     "הבא",
        "last":     "אחרון"
    }
},
{
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    }
    } );
} );

and for some reason they cant work together
what im doing wrong they both work perfectly fine alone but when im trying to combine them
i get nether
any help direction code you name it will much appreciated
cheers

add empty row in row grouping function

$
0
0

Hi ,
I use the datatable "row grouping" function. Its works great !
I would like to add an "empty" row after each row group to have a more readable table. Is it possible ?

On the following code , can i add an empty row with a new <tr> ?

if ( last !== group ) {
$(rows).eq( i ).before(
'<tr class="group"><td colspan="5">'+group+'</td></tr>'
);

Thanks for your help!

How can I limit (any) cell content to its column widths, not character count, hiding the overflow ?

$
0
0

Hi, ( I'm still quite new to dataTables, so please forget basic errors...)

I already tried the ellipsis plugin (https://datatables.net/plug-ins/dataRender/ellipsis), using a column setting like
columnDefs: [ {
targets: "_all",
render: $.fn.dataTable.render.ellipsis(18, true)
} ]

And it works, but since (afaik) it only limits the amount of displayed text by a fixed (18 in the example) char count... I need to dynamically adapt the text to the current column width... like I can do in css setting max-width: + overflow: + text-overflow: properties...

Is it possible in dataTables, and how, or what's the best way to deal with this?

Thanks,

Outdated example

$
0
0

This page contains an outdated example: https://editor.datatables.net/reference/api/field()

editor.field( 'first_name' ).val( 'Allan' );

// results in the same action as (the difference is in the returned values,
// not used here):
editor.field( 'first_name', 'Allan' );

Only the first line of code works in the current version of Editor.

Export to pdf, csv and xls don't work in Chrome

$
0
0

I ma trying to export a datatable using copy, pdf, xls and csv and print

With chrome:
Only print and copy is working with links from home datatables home site.
if I use JS nightly version only pdf, print and copy is working.

I just tested with IE11 and all is working.

Is psossible a fix to chrome latest version?


How to setup multiple independent data tables on single page? Calculated width of row table wrong.

$
0
0

I am using version 1.10.7 of DataTables.

I have five data tables on a single web page that are independent. They all pull from fixed AJAX sources.

I have the data loading great. But there ends up being a "calculated" margin that makes the data columns not line up with the header columns.

One table ends up perfect. The others end up with left/right margins of: 26, 19.5, 13, and 6.5.

All five data tables are setup in functions which are called in the $(document).ready section.

All look very close to the following(no columns in code stub below)

function SetUpMyInvDataTable() {
    var oTable = $('#MyInvDT').DataTable({
        "serverSide": true,
        "ajax": {
            "type": "POST",
            "url": '/Inv/MyDT',
            "contentType": 'application/json; charset=utf-8',
            'data': function (data) {
                return data = JSON.stringify(data);
            }
        },
        //        "dom": 'frtiS',
        "dom": 'C<"clear">lfrtip', //this display adds entries at top, allows show/hide columns at end
        "scrollY": 500,
        "scrollX": true,
        "scrollCollapse": true,
        "scroller": {
            loadingIndicator: false
        },
        "processing": true,
        "paging": true,
        "deferRender": true,
        "order": [0, "asc"],
        "language": {
            "emptyTable": "No Inventory To Display"
        }, //end langauge
        "pagingType": "full_numbers",
        "stateSave": false,
        "Paginate": true,
        "jQueryUI": true
        } //end initComplete
    });
}// end setup

The four other functions use actionTable1 to 4 instead of oTable. And all have different identifiers than MyInvDT. And the url for each is also different.

Are the table variables like oTable supposed to be global?

Is there a method to squelch the odd width calculation?

The HTML looks like:

    <div class="MyAction groupbox">
        <h4 class="section_divide">My Items Being Requested</h4>
        <div class="MyAction">The following items in your possession are being requested.  Please Approve/Deny the requests.</div>
        <table id="MyRequestedDT" class="table table-striped display" width="100%">
            <thead>
                <tr>
                    <th>Project</th>
                    <th>Is Part Of Config</th>
                    <th>Product Code</th>
                    <th>Serial</th>
                    <th>Description</th>
                    <th>Lot</th>
                    <th>Location</th>
                    <th>Requested By</th>
                    <th>More Info</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
   <div class="MyAction groupbox">
        <h4 class="section_divide">Items Being Reassigned To Me</h4>
        <div class ="MyAction">The following items are being reassigned to you.  Please Accept/Reject the requests.</div>
        <table id="ReassignedToMeDT" class="table table-striped display" width="100%">
            <thead>
                <tr>
                    <th>Project</th>
                    <th>Is Part Of Config</th>
                    <th>Product Code</th>
                    <th>Serial</th>
                    <th>Description</th>
                    <th>Lot</th>
                    <th>Location</th>
                    <th>Reassigned By</th>
                    <th>More Info</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>

Did I miss something in my table setup?

This issue is happening in Chrome(55) and Internet Explorer(11) under Windows 10 machine.

I've attached a truncated picture showing a good example of what is happening. In this example, the bottom table is good, the middle table got 6.5 margin, and the top table got 13 margin. But it doesn't always put the same margin to the same table.

Deactivate 'select' when first initializing the table - Multi Row Editing

$
0
0

Is it possible to deactivate the 'select' when initializing the table? And only activate the select after and if either one of 'selectRows', 'selectColumns', 'selectCells' is selected? And consequently deactivate the select if none of those buttons is selected?

I'm using Multi-Row Editing like this:

table = $('#my_table').DataTable( {
        dom: "Blfrtip",
        select: true,
        buttons: [
            {
                extend: 'collection',
                text: 'Select'
                buttons: [ {
                        extend: 'selectRows'
                    }, {
                        extend: 'selectColumns'
                    }, {
                        extend: 'selectCells'
                    }, {
                        extend: 'selectNone'
                    }, {
                        extend: 'edit',
                        editor: editor
                    }
                ]
            }
        ],
        ajax: {
              url: "/accounts.php",
              type: "POST"
        serverSide: true,
        processing: true,
        columns: [
 ...
        ]
    } );

As per default the select is always active with 'selectRows' selected. I tried ...

{
extend: 'selectRows',
enabled: false
}

... but did not do the trick. https://editor.datatables.net/examples/advanced/multiItem.html

Unable to use JQuery progressbar with DataTables

$
0
0

Hi there! I have a page that uses DataTables JS, and it's been working great. However, I recently tried to add a JQuery progress bar to the page. When I do this, I get a JS error like this:

Uncaught TypeError: $(...).progressbar is not a function

I tried commenting out the include for the DataTables JS, and when I did that, the JQuery progressbar error disappeared. I tried rearranging the order of the include statements, but that caused DataTables to break, with a similar error:

Uncaught TypeError: $(...).DataTable is not a function

Is it possible to use both DataTables and JQuery's progressbar? Or is there some work-around?

Thanks!

Excel Column width

$
0
0

I tried searching for this but all I am finding references TableTools... is there anyway to make the export function for Excel using Buttons to set the column width? I would really like for it to just autowidth.

Export hyperlinks to copy,csv, or excel

$
0
0

Let's say I have text in a column that contain regular text and hyperlinks in it. Is it possible to export it via any of the buttons so that it would appear? Current when I export it the code for the hyperlink does not appear (<a href="">LINK</a>), just the text in the link appears. Sorry if this has been asked before. I have searched and also read the reference material but can't find the answer. I guess I'm not smart enough.

unsupported sorting column index

$
0
0

Hello all,

I inherited a project that included DataTables. It had used a column that a client wanted to sort by. I figured out how to remove my column's index from the orderable:false columndefs, but I still get the ajax error "unsupported sorting column index" when they try to sort the column.

Thanks in advance for the help.

Regards,

Adam

Format Excel file from Export

$
0
0

Hi!
Thanks in advance all the help you can give me.

I am trying to format the excel file I got when exporting from datatables.

Right now I am doing this:

 {
        extend: 'excel',
        exportOptions: {
                   columns: '.exportable',
                    stripHtml: false,
                    format: {
                        header: function ( data, columnIdx ) {
                            return '<span style="width: 300px; background-color:blue; color:white;">'+data+'</span>';
                        }
                    }
        }
    },

But it prints the html tags (encoding them) in the final excel.
I want to add some colors and styles to the excel file, and I am not sure how.
Thanks!


I am creating the columns using a JSON

$
0
0

I am creating the columns using a JSON as in this example
  For j: = 0 to dmC.qry_clients.FieldCount-1
     If dmC.qry_clientes.Fields [j] .Visible then begin
       If j> 0 then
         Columns: = columns + ',';
       + DmC.qry_clientes.Fields [j] .DisplayLabel + '"}'; '';
     End;
   If columns <> '' then
     Columns: = columns + ',';
   Columns: = columns + '{"field": "action", "title": "action", "formatter": actionFormatter, "events": actionEvents}';
   Columns: = columns + ']';
How could I add a class or a formatting using JSON?

Fatal error: Call to private method DataTables\Editor::_ssp_field() from context ''

$
0
0

Hi

I am getting this error on the production server but not on my development laptop

Fatal error: Call to private method DataTables\Editor::_ssp_field() from context '' in /var/www/vhosts
/bookt.lanzarote1.com/httpdocs/inc/dt/php/lib/Editor/Editor.php on line 1444

Here is the debug for the development wamp platform which works fine - 3 tables each filtered / searched from select fields in form.

http://debug.datatables.net/amufuc

The server envronment is LAMP

Regards Mark

How to show add form only ?

$
0
0

How to show add form only , without show tables ? It like your datatables.net "login/Register"

Minor typo on ColReorder Page

Export Empty cells

$
0
0

Could you allow a customize option to export empty cells? The reason is if empty cells are not exported a style can not be applied because there is no cell definition. I would like to put a thin border around column B, but because cell B177 isn't defined the style will not be applied to B177 and when you look at the excel spreadsheet it looks ugly.

The current code (buttons.html5.js line 1040) skips over any null, undefined or blank cells.

                // For null, undefined of blank cell, continue so it doesn't create the _createNode
                if ( row[i] === null || row[i] === undefined || row[i] === '' ) {
                    continue;
                }

An update could look like

                    // For null, undefined of blank cell, continue so it doesn't create the _createNode
                    if (row[i] === null || row[i] === undefined || row[i] === '') {
                        if (config.exportEmptyCells) {
                            cell = _createNode(rels, 'c', {
                                attr: {
                                    r: cellId
                                }
                            });
                            rowNode.appendChild(cell);
                        }
                        continue;
                    }
Viewing all 81384 articles
Browse latest View live


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