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

Hide and create custom pageLength

$
0
0

Hi All,

Need help here for my custom pageLength for my table.

From this:

to this:

Thanks in advance.


Hello there i have a problem using inline editor with DataTables.

$
0
0

Whenever i clicked on the buttons above it gives me following error.

"Uncaught TypeError: this[t0Q] is not a function"

each sub-group in rowGroup is getting duplicated

$
0
0

Hi All,

After using rowGroup -> endRender Api of datatables... each grouped row is getting duplicated .. Any ideas for solving this ?

Thanks in advance.

display datatable over bootstrap modal

$
0
0

Hi,
I am stuck at showing data table over bootstrap modal while clicking button click event.

below is my event ...

$('.myModal .modal-body').load( '/patient.transfer', { ACTION : 'FETCH_PREVIOUS_SERVICE_ORDER', },
function(response, status, xhr) {
if (status === 'error') {
var msg = "Sorry but there was an error: ";
// alert(response);
swal( "Oh no!", msg + xhr.status + " " + xhr.statusText, "error");
}

$('.myModal').modal({show:true});

Issue with Horizontal Scroll

$
0
0

Its working fine on desktop however if I check on mobile device or try to inspect using responsive screen, scrollX divides in three different scrolls, head, body, and footer and all three scrolls work individually whereas they should work as one

HOW TO MAKE DATATABLES LOAD FASTER DEALING LARGE DATASETS (1million row)

$
0
0

Hello,
im currently working a project dealing large set of data around 1 million using datatables, im using PHP mysql for query and oracle 12c database. every time i run the program. data loads very slow. when i limit the data row to 50k only the load lessen. what i want is to load all the data faster and be paginated. but when the row go up 100k it load like hell. sorry for bad English..

for reference:
this is my table:
<table id="myTable" class="display table table-bordered">
<thead> <tr> <th>Account No</th> <th>Consumer Name</th> <th>ADDRESS</th> <th>Amount</th> </tr> </thead>

<tbody id="data" > <?php include("fetch2.php"); ?> </tbody>
</table>

fetch2.php:
<?php $statement = oci_parse($conn, "SELECT * FROM ethanhost.FDISCO ORDER BY CNAME ASC OFFSET 0 ROWS FETCH NEXT 500000 ROWS ONLY"); //<= this where i limit the rows oci_set_prefetch($statement, 50); oci_execute($statement); while($row = oci_fetch_array($statement)) { echo "<tr>"; echo "".$row['ACNT_CODE'].""; echo "".$row['CNAME'].""; echo "".$row['CADDRESS'].""; echo "".$row['AMOUNT'].""; echo ""; } oci_free_statement($statement); ?>

and my script for datatable:

$(document).ready( function () {
    $('#myTable').DataTable({
        });
} );

this code is perfectly fine with 50k rows below. but when i tried to load all the rows on our database it crash my browser and loads freaking bad and slow.
hope you can HELP me. THANKS!

Row click and checkbox click event not working

$
0
0

I am doing server side processing for showing the data and it is working fine except that my row click event and checkbox click event is not working. Here is the code:

    function BuildDatatable() {
        $.ajax({
           url: "Handlers/DatatableHandler.ashx",
           data: { Operation: 'ColumnNames' },
            success: function (data) {                  
                result = JSON.parse(data);                   
                //console.log(result);
                $('#tblEmployeeList').DataTable({
                    processing: true,
                    serverSide: true,
                    responsive: true,                                         
                    ajax: {
                        "url": "Handlers/DatatableHandler.ashx",
                        "data": { Operation: 'EmployeeList' },
                        "type": "POST",
                        "datatype": "json"                            
                    },
                    columns: result,
                    columnDefs: [
                        {
                            targets: 0,
                            render: function (data, type, row) {
                                if (type === 'display') {
                                    return '<input type="checkbox" class="editor-active">';
                                }
                                return data;
                            },
                            className: "dt-body-center",
                            orderable: false,
                            searchable: false
                        },
                        {
                            targets: 1,
                            visible: false
                        }                          
                    ]

                });
            }
        });
    }


    $('input.editor-active').on('change', function () {
        alert('checkbox clicked'); // it is never shown
        cb = $(this).prop('checked');
        console.log(cb)
    });


    $('#tblEmployeeList').on('click', 'tbody td:not(:first-child)', function () {
        alert('in'); // it is never shown
        var table = $('#example').DataTable();
        var row = table.row(this.closest('tr')).data();
        alert("EmployeeId: " + row[1]);   //EmployeeId
    });

Can you please suggest what part of code is not correct and how can I make it functioning?

Also is there a simple way to add a checkbox once the columns are fetched dynamically from the server i.e. i tried these statements: {
orderable: false,
className: 'select-checkbox',
targets: 0
}
but it does not render the checkbox. So what is the best approach to have a checkbox as a first column?

How to apply styling to a column value based on another column value?

$
0
0

I tried but unable to reach to that point
ex: if the "office" value ===''Tokyo'' then its position value i.e., text should be changed to 'red' color (wherever tokyo is found its relevant position should be changed to red)
I tried using columnDef,rowcallback method but it didnt workout for me.

Thanks
Koka


Draw and Ajax.Reload call next page

$
0
0

Hi,

I'm using datatables with serverside processing like this
var dt = $('.datatable').DataTable({ "searching": false, "processing": false, "serverSide": true, "pageLength" : 50, "ajax": "/Artikel/Data", "columns": [ ... ] });
I'm trying to redraw the page when a button has been clicked. I've tried both:
dt.draw(true);
and
dt.ajax.reload(null, true);

But both call the server with an incremented draw, so when I look in Chrome's Network panel I see:
Data?draw=1 followed by Data?draw=2 when I click the button again.

Anyone has any idea what is causing this and how I can solve it?
Thanks!

Frank

Footer Data Effecting Excel Export...

$
0
0

Is there any documentation, best practices or examples available on how to implement footers while maintaining the Column Auto Fit default associated with the ExcelHTML5 Export?

Most of our tables contain financial/numeric data and require footer information with totals and averages.

I am finding that the footer data is disrupting the Auto Fit sizing of columns when the table is exported to Excel.

Thank You.

Michael.

How to save data from View into SQL Server?

$
0
0

I'm using Microsoft ASP.NET MVC and managed to implement the Editor Datatables, but how do I save the values into my SQL Server? Thanks.

Please provide an example codes for Models, Views and Controllers. Cheers.

Mobile layout problem

$
0
0

I found this example for responsive layout (https://datatables.net/extensions/rowreorder/examples/initialisation/responsive)
and use this code

var table = jQuery('#tblOrder').DataTable( {
        rowReorder: {
            selector: 'td:nth-child(1)'
        },
        responsive: true,
        "order": [],
        "ordering": false,
        "searching": false,
        "language": {
            "url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Hebrew.json"
        }
    } );

but I can not make it work,
Here a link you can check "http://80.244.168.168/tours/jeep-tour-in-the-mountainous-greece-and-villages-of-zagorija/"
the table is on the third tab for the right, the one titled "מחירים ותאריכים" after the text there is a table, I use chrome's console and check the mobile layout and the green area is outside of the screen so I need to scroll, I also do not get the layout as n the example, what I can do?

Modify text color in cell based on content

$
0
0

Is it possible to change the color of text in a cell once the table has been rendered? I have some text values I'd like to apply a bootstrap style to once the data has been collected and the table has been drawn.

Editor: How to extend the table width

$
0
0

Hello!
How can I extend the Editor's table width. As screen shot below shows, the column width are too narrow. I need to extend table's over all width.

Thanks so much!

Alan

ajax load complete event

$
0
0

"ajax": "data/arrays.txt" - how to get ajax load completed event.


I want to edit a cell inside data table.

$
0
0

Hi. I want to edit a cell inside data table. We don't want to use editor, because customer didn't agree for paid version of data table. Has anyone have suggestion to provide. Please suggest.

Inline editor - Dropdown will not update database

$
0
0

I have a datatable that contains the contents of 3 joined tables, here is the server side:

Editor::inst( $db, 'enqitem', 'enqitemid')
->fields(
    Field::inst( 'stock.salmasid' ),
    Field::inst( 'stock.partnum' ),
    Field::inst( 'stockitem.salsubid' ),
    Field::inst( 'stockitem.condition1' ),
    Field::inst( 'stockitem.supplier' ),
    Field::inst( 'enqitem.enqitemid' ),
    Field::inst( 'enqitem.cost' ),
    Field::inst( 'enqitem.sale' ),
    Field::inst( 'enqitem.qty' ),
    Field::inst( 'enqitem.linedisc' ),
    Field::inst( 'enqitem.leadtime' )           
)
->leftJoin('stock', 'stock.salmasid', '=', 'enqitem.itemmasid')
->leftJoin('stockitem', 'stockitem.salsubid', '=', 'enqitem.itemid')
->where('enqitem.enqnr',141316)
->debug( true )
->process( $_POST )
->json();

And here is the editor:

let editor = new $.fn.dataTable.Editor( {
    ajax: {
        url: "ajax.php",
        type: "POST"
    },
     
    table: "#dataTableSites",
    fields: [{
            label: "ID:",
            name: "stock.salmasid",
            type: "hidden"
        },{
            label: "ID:",
            name: "stockitem.salsubid",
            type: "hidden"
        },{
            label: "ID:",
            name: "enqitem.enqitemid",
            type: "hidden"
        },{
            label: "Part Number:",
            name: "stock.partnum"
        },{
            label: "Condition:",
            name: "stockitem.condition1",
            type: "select",
            options: [
                { label: "New", value: "New" },
                { label: "Used", value: "Used" },
                { label: "Repair", value: "Repair" }
            ]
        },{
            label: "Supplier:",
            name: "stockitem.supplier",
            type: "select"
        },{
            label: "Cost:",
            name: "enqitem.cost"
        },{
            label: "Sale:",
            name: "enqitem.sale"
        },{
            label: "Qty:",
            name: "enqitem.qty"
        },{
            label: "Disc:",
            name: "enqitem.linedisc"
        },{
            label: "Delivery Time:",
            name: "enqitem.leadtime"
        }
    ]
} );

It is set to edit inline like so:

            $('#dataTableSites').on( 'click', 'tbody td:not(:first-child)', function (e) {
                editor.inline( this, {
                    onBlur: 'submit'
                } );
            } );

If I change a the sale value (which is an inputbox) I can see in the debug the following:

{"query":"UPDATE  `enqitem` SET  `sale` = :sale WHERE `enqitem`.`enqitemid` =....

However when I change the condition (which is a dropdown) the database never updates. In fact the debug doesn't contain an UPDATE statement at all, only a SELECT.

Does the dropdown need to be set up differently?

How to delete multiple rows by selecting the checkboxes of a column

$
0
0

i want to delete selected rows from the datatable

<script>
    $(document).ready(function () {
        $.ajax({
            "url": "Handlers/jQueryDatatableHandler.ashx",
            "data": { Operation: 'GetMessages', searchText: '' },
            success: function (data) {
                json = JSON.parse(data);
                columns = [];
                // build column titles
                for (var i = 0; i < json.colnames.length; i++) {
                    columns.push({ title: json.colnames[i] });
                }

                var table = $('#example').DataTable({
                    "responsive": true,
                    "processing": true, 
                    "serverSide": false, 
                    "order": [[4, 'desc']],
                    data: json.rows,
                    columns: columns,
                    columnDefs: [
                        {
                            targets: 0,
                            render: function (data, type, row) {
                                if (type === 'display') {
                                    return '<input type="checkbox" class="editor-active">';
                                }
                                return data;
                            },
                            className: "dt-body-center",
                            "orderable": false,
                            "searchable": false
                        },
                        {
                            targets: 1,
                            visible: false
                        },
                        {
                            targets: -1,
                            visible: false
                        }
                    ],
                    "lengthMenu": [2, 4, 8]
                });
            }
        });


        $('#example').on('click', 'tbody tr', function () {
         //do something   
        });
    });

    $('.editor-active').click(function () {          
        var table = $('#example').DataTable();
        var row = table.row($(this)).data();
        console.log(row);             
    });

    var buildstring = [];
    function BuildDeleteString(elem, id) {
        if ($(elem).is(':checked')) {
            if (buildstring.indexOf(id) == -1) {
                buildstring.push(id);
            }
        }
        else {
            var idx = buildstring.indexOf(id);
            if (idx != -1) {
                buildstring.splice(idx, 1);
            }
        }
    };

</script>

My first column is a checkbox column. I am doing something on row click and when I select the checkbox it fires the rowclick event and not the checkbox event.

I want to exclude the first column from the row click, how can i do that?

I want to call the 'BuildDeleteString' function whenever a checkbox is selected or unselected to store selected EmployeeId's so that on delete button click I can delete all the ids from the database.

Also I want to delete all the selected rows from the database and rebind the datatable, can you provide some example for this?

Nickel Alloy X-750 suppliers

$
0
0

General description:
Inconel X750 is precipitation-hardenable nickel-chromium alloy by additions of aluminum and titanium. It has good resistance to corrosion and oxidation along with high tensile and creep-rupture properties at temperatures to 1300°F (700°C).
Its excellent relaxation resistance is useful for high-temperature springs and bolts. Used in gas turbines, rocket engines, nuclear reactors, pressure vessels, tooling, and aircraft structures.
Basic parameter:
Melting range: 1393℃~1427℃
Density: 8.28g/cm³
Standard:
AMS5698, AMS5699 etc.
Chemical composition:
Ni Fe Cr Cu Co Nb+Ta
70.00 min5.00-9.0014.00-17.000.50 max1.00 max0.70-1.20
C S Si Ti Al Co
0.08 max0.01 max0.50 max2.25-2.750.40-1.001.00 max
Production process of inconel alloy X-750 wires:
Application of inconel alloy X-750 wires:
· Fasteners;
· Springs.
We can provide more:
With advanced equipment and technology, we can serve you other products as follows:
1.High temperature alloys (Casting master alloy, deformation super alloy and so on).
2.Corrosion resistant alloy.
3.Welding wire.
4.Precision alloys (soft magnetic alloy, expansion alloy and so on).
5.High resistance alloys for electrical heating.
6.Valve steel,
7.Forged parts and so on.Nickel Alloy X-750 suppliers
website:http://www.fortune-alloy.com/nickel-alloys/nickel-alloy-x-750/

China Drip Irrigation Equipment suppliers

$
0
0

Scientific Multi Season Automatic Agriculture Irrigation Drip Line
The technical features of drip irrigation line are as follows;
1. The control system is stable and operates conveniently.
2. Dripper Material is new material, which is durable enough to use at least two years.
3.The vacuum water tank, and the cooling device are all adopting the technology of stainless steel processing so as to make its accurate coining and vacuum stability more stable.
4. Double caterpillar band with its strong traction to operate smoothly, the running speed can be adjusted synchronously with its production speed.

With the market demand grows rapidly, we launched a series of combo of irrigation production line to choose for customers. Our drip line is engineered and tested to stand up to harsh chemicals, UV radiation and damage that can be caused by farm equipment, giving you years of worry-free performance.China Drip Irrigation Equipment suppliers
website:http://www.hxstdripgroup.com/drip-irrigation-equipment/

Viewing all 79607 articles
Browse latest View live




Latest Images