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

Adding a print PDF function

$
0
0

After using the generator to create a data-table called tasks, how do I add a "print pdf" function.? Would it be in the file /js/table.tasks.js?


Buttons Print - Microsoft Edge

$
0
0

Hello,

I seem to be having an issue with the Buttons extension, specifically when it comes to the print button. I am running Windows 10 and I found in Microsoft Edge when I click print, instead of showing the printer dialog along with the page to print, it only comes up and says blank page.

I figured it may be something in my code but all of the examples are doing the same thing.

Has anyone else run into this issue?

Scott

dateformat

$
0
0

Hi,

in my example I tried to set a dateformat in this way:
{
label: "SellDate:",
name: "sellDate",
def: function () { var d = new Date(); return new Date(d.getFullYear(), 11, 31); },
type: "datetime",
dateFormat: "dd.mm.YYYY"
},

or
{
label: "Date:",
name: "_stocks_fees.date",
type: "datetime",
dateFormat: "dd.mm.YYYY"
}
but it seems that the dateFormat variables were ignored and the date in the form and in the tables is still YYYY-MM-DD.

What did I wrong?

Thanks for any support

Patrick

can i create tfoot like thead

$
0
0

Hi Support,
"columns": [
{ "title" :"SLNo",data: 'slno','sClass': 'text-primary text-center' },
]

above statement automatically create thead and th in table , can i create tfoot .

Regards.
Sunil

Replace commas with dots

$
0
0

Hi,

I have some fields where I use "float" numbers (e.g. 2.81) and when I copy values from a source the numbers will be provided with a comma (like 2,81).

Is there a solution to replace the comma while/after paste it into the field?

Thanks in advance

Patrick

Path forward to add a nested child table

$
0
0

Hi All:

I'm new to DataTables and Editor, and I'm probably in over my head. So this is a request for guidance.

At present, I have a single table (grid) working beautifully. I can edit and delete records. I can add new records. The server side processing is working beautifully.

Each record represents a person or business. I call them entities. So each record describes someone that I call on regularly. (It's a contact database).

Now I wish to move forward toward a child/nested table. This would hold the (0-many) "touch" records. Each "touch" describes an interaction with an entity. You can imagine the use cases: For a given person or organization, I wish to see dates and notes from all the prior interactions. Each time I contact a person, I would add another "touch" record.

I have both tables built and populated with sample data (PostgreSQL). But at this point I do not know how to proceed forward, thus the request for general guidance.

I'm not sure of my next steps. How should I think about the path forward?
Is there any particular example which illustrates the newest and best approach for this requirement?

Thanks much. I am INSPIRED by this tool set, and eager to move forward.

Alan

Filtering mixing AND and OR into different columns

$
0
0

Hi, I want to create a filtering as described here (using only client-side processing) :
- (Filter a value 1 into the first column and a value 2 into the second column and a value 3 into the third column) or (a value 4 into the fourth column and a value 5 into the fifth column and a value 6 into the sixth column) or a value 7 into the seventh column...
--> For a better understanding of the filter, please take a look at the enclosed screenshot.

In my case, AND must have the priority against OR (parenthesis). I managed to create AND filter only (using fnFilter). But I'm stuck to create an OR filter that would take different AND values on different columns.

Is it possible to do this? How should I process?
In advance, thank you.

Deleting a row in joined table generate an SQL error. What do I do wrong?

$
0
0

I have 2 tables. One (otc_transport) stores useful info. The second is a link table that stores which transport is associated with a particular shipment order. So the link table has 2 columns: id_order and id_transport.
In my table, I need to display the list of transports, to add, edit and delete. As the table is in the current order page, the id_order is set directly.

I tried first the version with simple join.
I can add rows, I can edit rows, I can NOT delete a row.
Error when I confirm deleting the row is:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'otc_transport.id_transport' in 'where clause'

Here is the code:

Editor::inst( $db, 'otc_transport', 'id_transport' )
    ->fields(
        Field::inst( 'otc_transport.id_transport'),
                Field::inst( 'otc_transport_ord.id_order' ) ->setValue( $_GET['id_order']),
// useful fields:
        Field::inst( 'otc_transport.id_type' ),
        Field::inst( 'otc_transport.name' )->validator( 'Validate::notEmpty' ),
// more fields....
    )
    ->leftJoin( 'otc_transport_ord',   'otc_transport_ord.id_transport',   '=', 'otc_transport.id_transport' )
    ->where( 'otc_transport_ord.id_order', $_GET['id_order'] )
    ->process($_POST)
    ->json();

then I tried the Mjoin version for direct link as described in One-to-many joins documentation, but i get the warning:

DataTables warning: table id=tabel_transport - Table selected fields (i.e. '{table}.{column}') in Join must be read only. Use set(false) for the field to disable writing

Editor::inst( $db, 'otc_transport', 'id_transport' )
    ->fields(
        Field::inst( 'otc_transport.id_transport' ),
// useful fields:
        Field::inst( 'otc_transport.id_type' ),
        Field::inst( 'otc_transport.name' )->validator( 'Validate::notEmpty' ),
// more fields....
    )
    ->join(
        Mjoin::inst( 'otc_transport_ord.id_transport','otc_transport.id_transport' )
            ->fields(
                Field::inst( 'otc_transport_ord.id_order' ) ->setValue( $_GET['id_order'])
            )
    )
    ->process($_POST)
    ->json();

so..... what am I missing? What do I do wrong?
Why, if I can create a transport and the link tables is updated and all works perfect, I can not delete it? It makes no sense to me.

Other info:
1. Editor version is 1.6
2. I have no other bugs, all info are sent correct. Prove is that create and edit works ok.
3. if I remember well the delete was also working when I first created the table. We discover the bug now, on final testing. Maybe I did not had 1.6 back then? Can not tell for sure.
4. Debug with file_put_contents returns a wrong SQL: sql DELETE FROM `otc_transport` WHERE (`otc_transport`.`id_transport` = :where_1 AND `otc_transport_ord`.`id_ord` = :where_2 )


Troubles removing a child from a row.

$
0
0

Im trying to close all childs on my table, but when i do it, then it get bugged and i can't open any other child.

$('#tablaConsultarPolizasComisiones').DataTable().rows().eq(0).each( function ( idx ) {
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( idx );
if ( row.child.isShown() ) {
$('div.slider').hide(function(){
row.child.hide();
tr.removeClass('shown');
});~~~~
}
});

This is how i open the childs (This section is working perfectly).

$('#tablaConsultarPolizasComisiones tbody').on('click', '.details-control', function () {

var tr = $(this).closest('tr');
var rowAux = $('#tablaConsultarPolizasComisiones').DataTable().row( tr );

$('#tablaConsultarPolizasComisiones').DataTable().rows().eq(0).each( function ( idx ) {
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( idx );

if ( row.child.isShown() && (row.data() != rowAux.data()) ) {
$('div.slider').hide(function(){
row.child.hide();
tr.removeClass('shown');
});;
}
});

var tr = $(this).closest('tr');
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( tr );

for(var i = 0; i < self.polizas.length; i++){
if(self.polizas[i].numero == row.data()[0]){
self.polizas[i].editar = true;
self.polizaSeleccionada = i;
break;
}
}

if ( !row.child.isShown() ) {
console.log('ishown');
$('.slider').show();
row.child( $('div.slider') ).show();
tr.addClass('shown');
$('div.slider', row.child()).slideDown();
}

});

$('div.slider') is the div that i use as a child.

How to achieve child row functionality

$
0
0

Hello,

There are some rows in database that are child, some rows are parent and some rows doesn't have any child.

I have implemented it through details-control but it is showing clickable button on every row while in my case not all rows are clickable or has child, so can (+-) icon be removed from some rows or can be rendered based on some condition?

How can I bring content from right margin?

$
0
0

I'm really doing a quite simple action, and it looks really nice, but there is a strange problem I don't know how to code around how the search box at the top right has slid over. Even wrapping everything in a table won't bring the whole search field into view, and it just follows as you make the browser wider.

<!-- start for datatables -->
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.js"></script>
<script type="text/javascript">jQuery(document).ready( function () {
        jQuery('#emrTable').DataTable( {

        } );
    } );
</script>
<!-- end for datatables -->

...and I call it in a stock fashion as well:

  <table width="95%" id="emrTable" class="display">
                <thead>
                        <tr>
                                <th>Date</th>
                                <th>District</th>
                                <th>Lodge</th>
                                <th>Town</th>
                                <th>Name</th>
                                <th>Phone</th>
                                <th>Email</th>
                                <th>Why Join?</th>
                                <th>Comments</th>
                        </tr>
                </thead>
                <tbody>
  <?php foreach ($finalEmrUser as $sRow): ?>
                        <tr>
                                <td><?php echo $sRow['_field_5']; ?></td>
                                <td><?php echo $sRow['_field_7']; ?></td>
                                <td><?php echo $sRow['_field_9']; ?></td>
                                <td><?php echo $sRow['_field_20']; ?></td>
                                <td><?php echo $sRow['_field_1']; ?></td>
                                <td><?php echo $sRow['_field_6']; ?></td>
                                <td><?php echo $sRow['_field_2']; ?></td>
                                <td><?php echo $sRow['_field_11']; ?></td>
                                <td><?php echo $sRow['_field_10']; ?></td>
                        </tr>
  <?php endforeach; ?>
                </tbody>
        </table>

...so to me it appears this formatting at top is all done prior to the data...

Is there a better way to call the datatable code?

TIA!

Ajax handler is not invoked in DataTables

$
0
0

Hi, I'm a newbie in using jQuery DataTables plugin. I have this script below for the DataTable initialization.

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        var oTable = $("#tblFile").DataTable({
            "iDisplayLength": 10,
            "bServerSide": true,
            "sAjaxSource": "@Url.Content("PlayListFilesAjaxHandler")" + "?playListId=" + getParameter(),
            "bProcessing": true,
            "bStateSave": true,
            "aoColumns": [
                {
                    "sName": "FileName",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '25%'
                },
                {
                    "sName": "FilePath",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '50%'
                },
                {
                    "sName": "Order",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '10%'
                },
                {
                    "sName": "Action",
                    "bSearchable": false,
                    "bSortable": false,
                    "sWidth": '15%',
                    "render": function (data, type, full, meta) {
                        return '<a class="btn btn-primary deleteButton" href=\"FileDelete/' + full[3] + '\">Delete</a>';
                    }
                }
            ]
        });
    });
</script>

My problem is that I'm not sure if using the line below will eventually invoke the action method PlayListFilesAjaxHandler in my controller class.

"sAjaxSource": "@Url.Content("PlayListFilesAjaxHandler")" + "?playListId=" + getParameter()

Below I have two parameters for the said method

public ActionResult PlayListFilesAjaxHandler(string playListId, JQueryDataTableParamModel param)
        { ..... }

I'm stuck on this one because, PlayListFilesAjaxHander method is not invoked when the above script is being executed.

Any help is greatly appreciated.

Datatables Global Search Within Input Fields

$
0
0

Hello,

I have input fields within my datatable and I would like users to be able to search using the globalsearch and identify values within those input fields.

The fields range from dropdowns to text fields.

I have done quite a bit of hunting around but cannot find a solution.

Hope you can help!

Kind Regards,

Connor

Print to current window

$
0
0

I'm using the print button functionality to generate a report which is then dumped to pdf using wkhtmltopdf, however because it generates the printable view in another tab, the scraping tool isn't able to find it. Is there a way to have the print button's function dump the result to the current window instead of in a new window/tab?

Datatables individual column search in server side rendering

$
0
0

Hi, I am using datatables server side rendering , It is working fine. to access the length and start in back end i am using query.length and query.start so that values i am getting. But now i want to add individual column search, So i added the code. whenever key is up it is calling server but i dont know how to access the search value in database . This is my Individual column search code
$('#myTable tfoot th').each(function(i) { var title = $('#myTable thead th').eq($(this).index()).text(); $(this).html('<input type="text" class="search-input-text" placeholder="Search ' + title + '" data-index="' + i + '" />'); }); table.columns().eq(0).each(function(colIdx) { $('input', table.column(colIdx).footer()).on('keyup change', function() { table.column(colIdx).search(this.value).draw(); });


js file conflict

$
0
0

my problem is that i have like 2 (.JS) file in my layout, but both .js not work together.
1.
2.

please help me how to solve this.

probelm in js conflict

Is there a way to update two tables using Editor

$
0
0

I would like to use one model and one screen but, it would be possible to update two different tables using just one editor?

Thanks,
Wilson

How to write Mysql_subquery in datatables

$
0
0

Mysql Query Structure:

select ()

from ()

where in (select
from
where and )
and

        in (select
        from
        where  and )

    and

        c.id = t.id

I used datatables library in php framework codeIgniter. How to write above mysql_query in datatables. Pls help?

How to link a test case to a question ?

$
0
0

How do I link a test case to my question ??

Viewing all 81400 articles
Browse latest View live


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