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

Puirchased Medio support

$
0
0

On 17 Jan 2017 I purchased the Medio support, what did that buy me?

Regards,
Jim


I'm using server-side processing : nginx and sqlite

$
0
0

..........my html:
$(document).ready(function() {
var dataTable = $('#acao_table').DataTable( {
"processing": true,
"serverSide": true,
"ajax":{
url :"BF_acessoBbSqlite_acao.php", // json datasource
type: "post", // method , by default get
error: function(){ // error handling
$(".acao_table_error").html("");
$("#acao_table").append('<tbody class="acao_table_error"><tr><th colspan="4">Nenhum dado encontrado no servidor</th></tr></tbody>');
$("#acao_table_processing").css("display","none");
}
}
} );
} );

.... my server-side
if( !empty($requestData['search']['value']) ) {
$sql.=" AND (id LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR nome LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR cmt LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR mrid LIKE '" . $requestData['search']['value'] . "%' ) ";
}
$query = $sqlite_db->query($sql) or die("Com o search: BF_acessoBbSqlite_acao.php: get acao");
$totalFiltered = count($query->fetchAll());
$sql.=" ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " ";// adding length
$query = $sqlite_db->query($sql) or die("Erro no sql: BF_acessoBbSqlite_acao.php: get acao");

$data = array();
foreach ($sqlite_db->query($sql) as $row) { // preparing an array
$nestedData=array();

    $nestedData[] = $row["ID"];
    $nestedData[] = $row["NOME"];
    $nestedData[] = $row["CMT"];
    $nestedData[] = $row["MRID"];

    $data[] = $nestedData;

}

$json_data = array(
"draw" => intval( $requestData['draw'] ), // for every request/draw by clientside
"recordsTotal" => intval( $totalData ), // total number of records
"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching
"data" => $data // total data array
);

echo json_encode($json_data); // send data as json format

<?php > -- VISUAL LINE -- ?>

Feature Request: Allow render to return an HTML element.

$
0
0

Right now, when defining columns, you need to return a string, which is added to the column. It would be nice if you could return HTML elements as well, so that you can add your own custom functionalities. For example:

Right now, you'd have to do:

'columns': [
    {
        'data': 'title',
        'render': function(val, _, obj) {
            return '<a href="http://youtu.be/' + obj.videoId + '" target="_blank">' + val + '</a>';
        }
    },

What would be nice, is to do something like:

'columns': [
    {
        'data': 'title',
        'render': function(val, _, obj) {
            //Here I can attach custom handlers, and things that you can't normally do with setting inner/outerHTML.
            return $('<a/>').text(val).attr('href', 'http://youtu.be/' + obj.videoId);
        }
    },

Editor: avoid table reloading after an inline edit

$
0
0

I use the DataTables plugin for managing a table with the server-side data source https://datatables.net/examples/data_sources/server_side.html + the Editor plugin.

After some field is edited, submitted and a response from the editor's server handler is returned, the table always completely reloads itself, sending an extra AJAX request to the server, even though there's no need to do that since only one field in only one row was changed and all the data required to redraw the table row have already been received in the previous inline edit response.

So the question is whether it's possible to get rid of the extra AJAX call and redraw the edited row only, rather than completely refreshing the whole table.

on Data Table row click event image pops up

Duplicate table header is created when scrollY is enabled..

$
0
0

Without the horizontal scrollbar, the table displays fine without any duplicate TH. Once we enable scrollY, as you can see in the image, the TH is duplicated and additional white space is created. I've seen others who have posted with a similar issue but without any response. Please advise.

Also, this issue only occurs on IE. (Version 11.0.9600.18537CO)

            var table =   $('#multemp').DataTable({
            "bPaginate": false,
            "bSort": true,
            "bFilter": true,
            "bJQueryUI": false,
            "bProcessing": true,
            "scrollY": "350px",

            "bScrollCollapse": true

i am new to datatables, on my server side how do i deploy the grid

$
0
0

i need to deploy the datables grid, but how do i do it

How can data tables search bar only return distinct values?

$
0
0

For example if I search for large, xlarge is also returned...

Are there any examples to how I can have the data tables search box only return distinct results from what I search?


Colvis dt-button-collection

$
0
0

i need to attach dt-button-collection to a specific container inside the markup. the default is dt-button-collection getting attached to the body tag with an absolute positioning. when i scroll and dt-button-collection is shown, it floats in the page.

Datatables - Responsive Row Trigger

$
0
0

https://datatables.net/reference/event/responsive-display

I'm having a issue where the ajax reload function is causing the datatables responsive plugin to close the open row details.
table.ajax.reload( null, false );

I'm aware of a workaround for select2 fields by listening for the ajax request (below) and I am confident I'll have to use this approach with this issue.
table.on('xhr.select2Fix', function(){

My question is can I trigger the responsive plugin to open a row ID manually (for my problem here I can simply record the rowID on this event)
table.on( 'responsive-display', function ( e, datatable, row, showHide, update ) {

or do I only have the option of using the button beside the row to toggle the expansion/retraction of the responsive display?

Show only two columns by select them using two dropdpwn menu?

$
0
0

Hi all,
I have a large table and I would like to show only two columns by selecting them using two different dropdown menus.
How can I do this with datatables?
After displaying the two choosen columns I need to compare all values in the first column with the values in the second column, for every row. I should display a "no change" text in the second column when a match is found.
Can I do this with DataTables?
TIA
tony

Remove checkbox from header

$
0
0

Hi there,
I have just started getting into Data Tables and am struggling with trying to remove a checkbox from the header cell of the column. I am using checkboxes to help the user see when a column is selected but I can't figure out how to remove the one that is inserted automatically in the header of the column that is making it look a bit ugly. I am probably missing something really obvious.

Here is the Javascript I am using.
Any help is appreciated.
Thanks.

$('#grAddUserTable').DataTable({

                columnDefs: [ {

                        orderable: false,
                        className: 'select-checkbox',
                        targets:   0
                    } ],
                    select: {
                        style:    'os',
                        selector: 'td:first-child'
                    },
                    order: [[ 1, 'asc' ]],

                pageLength: 5,
                responsive: true

            });

Exclude some data in column for search

$
0
0

I have a lot of text data in some columns (select with big number of options)
The problem, that these columns break the search (bFilter) on client side because we always can find some data in such big selects, which matches with this searching phrase.
How I can avoid it? I don't want to exclude all column from search, just some part of it.
For example, I want to search by selected options, but avoid options which not selected yet.
Looks like I can use escapeRegex() for this, but not sure that it's the best solution.
v. 1.10.9
Thx for any help.

Datatables with MultiFilter, MultiFilterSelect and Preselection (Search AND Select Filter)

$
0
0

See this fiddle:
https://jsfiddle.net/ckmuc/83n1uxsd/7/

Most of my needs do work - however I cannot find out, on how to combine a "Select Filter" and a search when initially loading the page.

When running the fiddle, the search for '2009' is already working. I would also like the "Office" dropdown to be populated with "San Francisco" (on inital loading of the table without any user interaction).

I tried a lot of the suggested solutions from the forum here and on StackOverflow - but to no success ...

How to alert if ajax response is empty

$
0
0

I had such good luck last time that I thought I'd try again.

I'm working on trying to add some extra validation and /or errors into my page. While it is unlikely, there is a fringe case where the Ajax query that is used to populate my datatable could return nothing. ( "[]" ). In such cases this results in the table displaying a "No data in table" message. If possible, I would like to be able to add an extra validation step that will allow me to pop an alert message to inform the user exactly what situation would've caused the no data .

I'm having a hard time figuring out where I could throw a validation check in to check the ajax response. there is no success function in the datatables ajax, and if I add one it breaks the page load. If I try adding it elsewhere in the initialization it doesn't work either or causes syntax errors.

This makes me believe that I would need to check for a no data situation once the datatable is completely initialized, but I'm not sure what the best way to do such a check is. Any help would definately be appreciated. :smile:


columnDefs, orderData, targets

$
0
0

Please help, what is the purpose of targets?
here are some results:

columnDefs: [{
targets: [ 1 ],
orderData: [ 1,0 ]},

Airi Satou Accountant
Airi Satou Accountant
Airi Satou Accountant
Angelica Ramos Chief Executive Officer (CEO)

columnDefs: [{
targets: [ 0 ],
orderData: [ 1,0 ]},
Airi Satou Accountant
Airi Satou Accountant
Airi Satou Accountant
Garrett Winters Accountant
Angelica Ramos Chief Executive Officer (CEO)

thank you

One Search button for two categories

$
0
0

Hi,

I have different categories in my table and I want to implement one search button to show two categories (of 5).

Actually I use this code:

{
                text: 'Purchased',
                action: function ( e, dt, node, config ) {
                    var table = $('#sites').DataTable();
                    table.columns( 1 ).search( "Purchased" ).draw();
                }
            },{
                text: 'Sold',
                action: function ( e, dt, node, config ) {
                    var table = $('#sites').DataTable();
                    table.columns( 1 ).search( "Sold" ).draw();
                }
            }

And I tried to change it into this (which doesn't work also with enabled regex):

{
                text: 'Purchased or Sold',
                action: function ( e, dt, node, config ) {
                    var table = $('#sites').DataTable();
                    table.columns( 1 ).search( "Purchased|Sold" ).draw();
                }
            }

Have anybody an idea to merge the to buttons without changing the categories?

Thanks in advance

Patrick

Trivial typo in the language.infoEmpty documention

verbosity won't turn off after setting to `TRUE` with `on`

$
0
0

I seem to be unable to turn off verbosity for data.table after using on. I'm using RStudio v1.0.136 and data.table v1.10.0.

I originally executed this statement from the data table vignettes:

setindex(flights, origin)
flights["JFK", on = "origin", verbose = TRUE][1:5]

I then turned verbosity back off, both by running this command again with verbose = FALSE and by manually turning them off via options("datatable.verbose" = FALSE). I also checked R's own verbosity setting via options(), which is also FALSE.

Since running that first command, irrespective of the verbosity settings, every time I save my code file (:w) and seemingly at some random points in between, I see output like this:

Calculated ad hoc index in 0.006 secs
Starting bmerge ...done in 0 secs
Calculated ad hoc index in 0.005 secs
Starting bmerge ...done in 0 secs
Calculated ad hoc index in 0.005 secs
Starting bmerge ...done in 0 secs
Calculated ad hoc index in 0.005 secs
Starting bmerge ...done in 0 secs
Calculated ad hoc index in 0.005 secs
Starting bmerge ...done in 0.001 secs

If I detach the data.table package they stop. I don't know if this is a bug or if there's some setting I'm unaware of, but I'm learning toward the former.

Any ideas?

DataTables Editor can't see PHP database driver

$
0
0

I'm trying to get DataTables editor set up with PHP 5.5.38 and MSSQL server.

I am getting an error saying it can't find the proper driver, but I have sqlsrv enabled (Both in screenshots below)

I am able to use the PDO object in other places without a problem. Any ideas?

Viewing all 81388 articles
Browse latest View live