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

Server-Side Processing Script - How to edit

$
0
0

I require extra functionality on a server-side processing table. Following is the example provided by DataTables:

$columns = array(
    array( 'db' => 'inv_id', 'dt' => 0 ),
    array( 'db' => 'inv_item_code', 'dt' => 1 ),
    array( 'db' => 'inv_category', 'dt' => 2 ),
    array( 'db' => 'inv_desc', 'dt' => 3 ),
    array( 'db' => 'inv_price', 'dt' => 4 ),
    array( 'db' => 'z', 'dt' => 5 )

My problem is that in queue/column 5 (now 'z') I need the following code instead of collecting data from column 'z', but rather have a button with functionality. The JavaScript function in the following line works perfectly without server-side Processing but takes too long to open all the data, thus I need the Server-Side Processing functionality.

The following creates a button in the table cell with added functionality:

<td class='td-actions'><center><input type="button" class="button_add btn btn-small btn-info" name="add" id="<?php echo $row['inv_id']; ?>" value="+"></center></td>

Can anyone help me to incorporate the above into array[5] of the server-side script?

Thanx in advance.


Difference between button.dt-button and a.dt-button

$
0
0

Hi, I am usig Editor in two different applications. In both cases the used code is of the type

buttons: [
  { extend: 'create', editor: editor },
  { extend: 'edit',   editor: editor },
  { extend: 'remove', editor: editor },
  { extend: 'excel', exportOptions: {columns: [1, 2, 3, 4]}, className: 'visible-lg-inline-block' }
]

but the generated markup is different
In case 1. I get

<a class="dt-button buttons-create" tabindex="0" aria-controls="iWarranty" href="#"><span>New</span></a>

In case 2. I get

<button class="dt-button buttons-create" tabindex="0" aria-controls="iSalesTable"><span>New</span></button>

I cannot understand why in case 1. the <a> tag is generated and in case 2. the <button> tag is generated and I don't know how to control the choice.
I was not able to find any explanation. Can someone help me? Thanks

Buttons - Search

$
0
0

Hello,

I'm trying to write js which will filtr my table, but I cannot do it... and I do know how...

I want for example click on "UP" button (Bootstrap) and then in the column "Status" I want only to have the rows where status = "UP".

<script type="text/javascript">
        $(document).ready(function(){
            $('#datatable').DataTable( {
                dom: 'Bfrtip',
                buttons: [
                    'csv', 'excel'
                ]
            });
        });
    </script>

Date formatting using inline editing with date picker.

$
0
0

I trying to figure out how handle date formats using DataTable Editor, with inline datepicker.

I am using a SSP script to retrieve and update my database.

The field I need is stored in the DB as YYYMMDD format (text).

So I need to achieve the following...

  1. Convert the date from YYYYMMDD to mm/dd/yyyy for the front-end DataTable .
  2. When user changes date using datepicker inline, I need to update the back-end database with the YYYMMDD format.

This would also apply to the DataTable Editor form field as well.

SSP

<?php
// DataTables PHP library
require( $_SERVER['DOCUMENT_ROOT']."/DataTables_Editor/php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'NWxxxx.PAYxxxx', 'HREMxx')
->debug(true)
    ->fields(
        Field::inst('HRLxx'),
        Field::inst('HRLOxx'
         Field::inst('HRNOxx'),
        Field::inst('HRNAMxx'),
        Field::inst('HREFDTxx')       // SALARY EFFECTIVE DATE - Formatted YYYMMDD
)
    ->process( $_POST )
    ->json();

JS


<script type="text/javascript" src="/js/jquery-current.min.js"></script> <script type="text/javascript" src="/jquery-ui-1.12.0/jquery-ui.min.js"></script> <script type="text/javascript" src="/js/jquery.dataTables.min.js"></script> <!-- <script type="text/javascript" src="/js/dataTables.fixedHeader.min.js"></script> --> <script type="text/javascript" src="/js/dataTables.fixedColumns.min.js"></script> <script type="text/javascript" src="/js/dataTables.buttons.min.js"></script> <script type="text/javascript" src="/js/dataTables.select.min.js"></script> <script type="text/javascript" src="/DataTables_Editor/js/dataTables.editor.min.js"></script> <script type="text/javascript" src="/js/dataTables.rowGroup.min.js"></script> <script type="text/javascript" src="/DataTables_Editor/js/editor.display.js"></script> <script type="text/javascript"> var editor; //global for the submit and return data rendering var table; // global for the data table //**************************************************************************** //** $(document).ready(function() //**************************************************************************** $(document).ready(function() { editor = new $.fn.dataTable.Editor( { ajax: "ssp_script.php", table: "#approvalTable", fields: [ {label: "Employee Name", name: "HRNAMxx", type: "display", }, {label: "Employee Number", name: "HRNOxx", }, {label: "Effective Date", name: "HREFDTxx", // SALARY EFFECTIVE DATE - Formatted mm/dd/yyyy }, ] } ); // Activate an inline edit on click of a table cell $('#approvalTable').on( 'click', 'tbody td:not(:first-child):not(\'.live\')', function (e) { editor.inline( this, { onBlur: 'submit' } ); } ); table = $('#approvalTable').DataTable( { lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]], }, scrollX: true, dom: "Bfrtip", ajax: "ssp_HourlySalaryIncreaseApproval.php", type: 'POST', order: [[2, 'asc']], columns: [ { data: null, defaultContent: '', className: 'select-checkbox', orderable: false }, { data: "HRLxx"}, { data: "HRLOxx"}, { data: "HRNOxx" }, { data: "HRNAMxx" }, { data: "HREFDTxx" }, // SALARY EFFECTIVE DATE - Formatted mm/dd/yyyy ], select: { style: 'os', selector: 'td:first-child' }, buttons: [ // { extend: "create", editor: editor }, { extend: "edit", editor: editor }, // { extend: "remove", editor: editor } ] } ); });//END $(document).ready(function() </script>

Unneccessary hiding of a column

$
0
0

I have a table which conveniently fits on a 1092pixel-screen, yet when I enable the Responsive-Option, the last column unneccessarily goes into child-mode. Do I need to set any options to prevent that behaviour?

Responsive table here, debug: ewaxul, unreponsive counterpart.

Table is rendered using

$(function(){$("#sample").DataTable(
  {
   "columns":[{},{"className":"dt-right"},{"className":"dt-right"},{"className":"dt-right"},{"className":"dt-right"}],
   "mark":true,
   "responsive":false
  });
});

Does Editor support "Edit" / "New" with multi-level joins where some elements of the join are empty?

$
0
0

I have just started using Datatables and Editor so I apologise if this seems obvious.

I have a db structure that is similar to:
t1.id
t1.t2id
t1.data

t2.id
t2.data

t3.id
t3.t2id
t3.data

And display in Editor
t1.data, t2.data, t3.data

which seems to work as expected. However, if I try inline edit t2.data or t3.data for a row where t2 and t3 do not exist I get the error:
An SQL error occurred: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

Is this expected? What is the sop to create rows where they do not exist?
(P.S. This error also occurs when using the new pop-up)

Standalone edition : edit() by id

$
0
0

Hi,

I'm looking for a way edit a specific record (lets says with id #7) by clicking on a link (there is no table on my page).

I closely read the following from the edit() documentation:

Standalone editing - Not required. Standalone editing cannot use multiple form sources like DataTables editing, a single Editor instance refers to a single configuration set in the database, so this option is not required, however, it can still be provided to give identification information to the server. Whatever value is given here will be passed to the server as the id parameter. Use null if you want to provide the other parameters (show and options) and do not require a value to be given.

So, to my understanding I could do such thing in js as :

non_conformity_editor.edit(7)

and it would edit record with id #7? Actually it opens the editor modal but with empty records.

Many thanks!

Sébastien

How do I find a developer to help with Airtable/DataTables setup and customisation for Wordpress

$
0
0

Hi There. I am new to this forum and hope I am asking this question in the correct place. I have A DIVI/Wordpress site and have just setup my tables in Airtable. My problem now is displaying them correctly on my relevant pages as static tables, this is hopefully where DataTables can help based on the examples I have seen.

I assume it will only be a small job once configured and would like to know the best place to request the help of a developer.

Thanks for your help.


UTF8 problem

$
0
0

Hi guys,

I am doing some data scraping and storing the data into MYSQL database.

The field in question is set in MYSQL to UTF8.

I get the following data into the database as

 <div class="panel marTop20">
                <h3>Technical Specs</h3>
                <p>No Load Speed: 2,500-4,200/min.<br>Depth of Cut: @90º: 59mm, @45º: 44mm.<br>With Guide Rails: @90º: 55mm, @45º: 40mm.<br>Blade: 165x20mm Bore<br>Bevel Capacity: 47<br>Weight: 4.7kg</p>
            </div>
            &nbsp;
'''

but the ' deg o' is shown as ' º '

I have tried using decodeURIComponent(escape) in the render but I get error 'URIError: URI error.'

my php is

<?php
header('Access-Control-Allow-Origin: ');
header('Access-Control-Allow-Methods: GET, POST');
$quoteID = $_GET["quoteID"];
/

* Example PHP implementation used for the index.html example
*/

// DataTables PHP library
include( "DataTables.php" );

// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'products3','productID' )
->fields(
Field::inst( 'products3.productID' )->set(false),
Field::inst( 'products3.manufacturerCode' ),
Field::inst( 'products3.TBcost' ),
Field::inst( 'products3.TBmyCost' ),
Field::inst( 'products3.CTSmyCost' ),
Field::inst( 'products3.tradeNett' ),
Field::inst( 'products3.trade' ),
Field::inst( 'products3.retail' ),
Field::inst( 'products3.TBstockCode' ),
Field::inst( 'products3.barCode' ),
Field::inst( 'products3.shortDesc' ),
Field::inst( 'products3.longDesc' ),
Field::inst( 'products3.category' )
->options( Options::inst()
->table( 'categories2' )
->value( 'catID' )
->label( 'name' )
)//,
//Field::inst( 'categories2.name' )
)
->join(
Mjoin::inst( 'fileDetails' )
->link( 'products3.productID', 'productFiles.productID' )
->link( 'fileDetails.id', 'productFiles.fileID' )
->fields(
Field::inst( 'filename' ),
Field::inst( 'web_path' ),
Field::inst( 'id' )
->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/upload/ID.EXTN')
->db( 'fileDetails', 'id', array(
'filename' => Upload::DB_FILE_NAME,
'filesize' => Upload::DB_FILE_SIZE,
'web_path' => Upload::DB_WEB_PATH,
'system_path' => Upload::DB_SYSTEM_PATH
) )
->validator( function ( $file ) {
return$file['size'] >= 10000000 ?
"Files must be smaller than 10 meg" :
null;
} )
//->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image" )
)
)
)
//->leftJoin( 'sites', 'sites.id', '=', 'products3.site' )
->process( $_POST )
->json();


I also tried adding this to the bootstrap.php file.

$db->sql("SET character_set_client=utf8");
$db->sql("SET character_set_connection=utf8");
$db->sql("SET character_set_results=utf8");
````

How do I handle this issue please.

Cheers

Steve Warby

Showing loading on using Ajax on data table

$
0
0

Hello,

I have created a data table to show the data in list using thymleaf template engine of java and jquery.
It works fine but when I want to to refresh the table on a event it shows me "loading..." on the table while all the
data is fetched from server.
Please help to resolve this.

Thanks in Advance


var table = $('#data-table').DataTable( {

     //reload part
     "ajax":{
         "url" : "/vedanta-web/scorecard/reloadScoreCardTableByMonthAndYear",
         "dataType": "JSON",
         "type" : "POST",
         "data":'{}',
         "dataSrc": "Data",
         "success": function(data, textStatus) {
             alert("success and data: "+JSON.stringify(data));
             console.log(JSON.stringify(data));
         }
     },

        "order": [],
        "stateSave": true,
        "columnDefs": [{
            "targets"  : [-1,-2],
            "orderable": false,
        },
        {
            "targets"  : [0],
            "orderable": false,
        }],


        "columns": [
            {"data": "contractNumber"},
            { "data": "contractId"},
            { "data": "vendor.name"},
            { "data": "categoryName"},
            { "data": "subCategoryName"},
            { "data": "yearId"},
            { "data": "template.frequency"},
            { "data": "submitted_by"},
            { "data": "submitted_on"},
            {"data": "status"},
            {"data": "contractNumber"}
            ]


    } );

The column.render callback runs too many times

$
0
0

While doing some refactoring of code to improve performance, I noticed an issue with column.render option.

When a function is defined to the column.render option, during table initialization the function is called way too many times for the display type. It runs more than once for each column and even when the deferRender: true is enabled, it runs at least once for each cell.

Take the following example:

$('#example').DataTable( {
  data: ExampleData,
  deferRender: true,
  columns: [
      { data: "name" },
      { data: "position" },
      { data: "office" },
      { data: "extn" },
      { data: "start_date", render: function (data, type, row, meta){
        if( type === "display" ){
            console.log("column " + meta.col);
        }
        if( type === "sort" ) return data.timestamp;

        return data.display;
      } },
      { data: "salary" }
  ]
} );

I would expect the console.log output to only get called 10 times on initialization (since the deferRender: true) option is on. However, it actually runs 68 times.

If I disable the deferRender option, it runs 114 times.

Here's a live example:
https://jsfiddle.net/dswitzer/539q35p8/1/

Why is this running so much? Shouldn't it only call the "display" type when actually rendering?

Does datatable supports adding button inside cell with angular 4 ? how to achieve this ?

$
0
0

I am using datatable with angular 4. but I am not sure whether it supports adding button inside cell .when button is clicked, it should open a popup window with current row details.
or
When button is clicked it should redirects to another component.
Thank you in advance

Datatable not showing properly in modal box

$
0
0

Hi
I am trying to show a datatable in a modal box, which opens when user clicks a button.
Although the datatable is loading properly but its overflowing outside the modal box.

What I want to do is,
display data table in modal box properly (I am okay if it hides some of the columns and adds a (+) to expand the view ..
same as responsive mobile/tab view.

You can see the problem here

URL : http://gadhiya.in/dispatch
UNAME: kaustubh.agrawal2012@gmail.com
PWD : 12345678

After login > Click transactions > click Dispatch > Click (New) > click (Select Sauda) button on the editor form

I have checked a few things out as below, but without any success
https://datatables.net/examples/api/tabs_and_scrolling.html
https://datatables.net/forums/discussion/41870/column-width-not-working
https://stackoverflow.com/questions/25215750/datatables-does-not-becomes-responsive-on-bootstrap3-modal-dialog

Please help me with this.
Thanks.

How to remove padding from Bootstrap data table

$
0
0

I am using the Bootstrap enabled data table and want to remove the left/right padding. The DataTables.net JavaScript inserts a DIV above my data table like:

<div id="reports_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4 no-footer">

The container-fluid class is what has the padding, but I don't want to override this as it is a standard Bootstrap class. Given the "id" can be different from data table to data table, what would be the best way to override this given the dynamic way the DIV is inserted into the DOM?

Thanks.

Validation in ColdFusion

$
0
0

Alan, need to validate drop down as required using ColdFusion using the Editor. Searched the forum and the web and I just can't seem to get started. Can you point me in the right direction by showing me a sample script?

Also, I am using a calendar to enter a date field. However, I do not want the user from entering them since they can enter a text or invalid date format. Thanks.


UnCaught Error

$
0
0

Error:

Uncaught TypeError: $(...).DataTable is not a function
at HTMLDocument.<anonymous> (datatable-responsive.js:17)
at j (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.I (jquery.min.js:2)

I am moving my site to responsive therefore the base code is already written and I wan t to keep the directory structure in place to reduce work

The site I am moving over has server side includes in a index.php file. Here is the index.php file:

<!DOCTYPE html>
<html lang="en" data-textdirection="ltr" class="loading">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="description" content="Robust admin is super flexible, powerful, clean &amp; modern responsive bootstrap 4 admin template with unlimited possibilities.">
    <meta name="keywords" content="admin template, robust admin template, dashboard template, flat admin template, responsive admin template, web app">
    <meta name="author" content="PIXINVENT">
    <title>XXXXXXXX</title>

    <script src="../app-assets/js/core/libraries/jquery.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/tether.min.js" type="text/javascript"></script>
    <script src="../app-assets/js/core/libraries/bootstrap.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/perfect-scrollbar.jquery.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/unison.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/blockUI.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/jquery.matchHeight-min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/jquery-sliding-menu.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/sliders/slick/slick.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/ui/screenfull.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/extensions/pace.min.js" type="text/javascript"></script>
    <!-- BEGIN VENDOR JS-->
    <!-- BEGIN PAGE VENDOR JS-->
    <script src="../app-assets/vendors/js/charts/raphael-min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/charts/morris.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/charts/chart.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/charts/jvector/jquery-jvectormap-2.0.3.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/charts/jvector/jquery-jvectormap-world-mill.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/extensions/moment.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/extensions/underscore-min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/extensions/clndr.min.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/charts/echarts/echarts.js" type="text/javascript"></script>
    <script src="../app-assets/vendors/js/extensions/unslider-min.js" type="text/javascript"></script>
    <!-- END PAGE VENDOR JS-->
    <!-- BEGIN ROBUST JS-->
    <script src="../app-assets/js/core/app-menu.js" type="text/javascript"></script>
    <script src="../app-assets/js/core/app.js" type="text/javascript"></script>
    <script src="../app-assets/js/scripts/ui/fullscreenSearch.js" type="text/javascript"></script>
    <!-- END ROBUST JS-->
    <!-- BEGIN PAGE LEVEL JS-->
    <script src="../app-assets/js/scripts/tables/datatables-extensions/datatable-responsive.js" type="text/javascript"></script>

    <link rel="apple-touch-icon" sizes="60x60" href="../app-assets/images/ico/ONHopsLoggerIcon.png_64x64.png">
    <link rel="apple-touch-icon" sizes="76x76" href="../app-assets/images/ico/apple-icon-76.png">
    <link rel="apple-touch-icon" sizes="120x120" href="../app-assets/images/ico/apple-icon-120.png">
    <link rel="apple-touch-icon" sizes="152x152" href="../app-assets/images/ico/apple-icon-152.png">
    <link rel="shortcut icon" type="image/x-icon" href="../app-assets/images/ico/ONHopsLoggerIcon.png.ico">
    <link rel="shortcut icon" type="image/png" href="../app-assets/images/ico/ONHopsLoggerIconBlack48x48.png">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <!-- BEGIN VENDOR CSS-->
    <link rel="stylesheet" type="text/css" href="../app-assets/css/bootstrap.css">
    <!-- font icons-->
    <link rel="stylesheet" type="text/css" href="../app-assets/fonts/icomoon.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/fonts/flag-icon-css/css/flag-icon.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/sliders/slick/slick.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/extensions/pace.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/charts/jquery-jvectormap-2.0.3.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/datatable/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/extensions/responsive.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/extensions/colReorder.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/extensions/buttons.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/datatable/buttons.bootstrap4.min.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/tables/extensions/fixedHeader.dataTables.min.css">


    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/charts/morris.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/extensions/unslider.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/vendors/css/weather-icons/climacons.min.css">
    <!-- END VENDOR CSS-->
    <!-- BEGIN ROBUST CSS-->
    <link rel="stylesheet" type="text/css" href="../app-assets/css/bootstrap-extended.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/css/app.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/css/colors.css">
    <!-- END ROBUST CSS-->
    <!-- BEGIN Page Level CSS-->
    <link rel="stylesheet" type="text/css" href="../app-assets/css/core/menu/menu-types/vertical-menu.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/css/core/menu/menu-types/vertical-overlay-menu.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/css/core/colors/palette-gradient.css">
    <link rel="stylesheet" type="text/css" href="../app-assets/css/plugins/calendars/clndr.css">
    <!-- END Page Level CSS-->
    <!-- BEGIN Custom CSS-->
    <link rel="stylesheet" type="text/css" href="../assets/css/style.css">
    <!-- END Custom CSS-->

    <!-- BEGIN VENDOR JS-->


  </head>
 <body data-open="click" data-menu="vertical-menu" data-col="2-columns" class="vertical-layout vertical-menu 2-columns  fixed-navbar">
<?php
$pass = array('dashboard','varieties','variety_details','variety_edit','variety_add', 'variety_modify'); //Sample array

include ($_SERVER['DOCUMENT_ROOT'] . '/portal/portalinc/title.php');
include($_SERVER['DOCUMENT_ROOT'] . '/portal/portalinc/menu.php');

if (in_array(isset($_GET['id']), $pass)) {
    include ($_SERVER['DOCUMENT_ROOT'] . '/portal/portalinc/' . $_GET['loc'] . '/' . $_GET['id'] . '.php');
}

else {

 include($_SERVER['DOCUMENT_ROOT'] . '/portal/portalinc/main.php');

}
?>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/portal/portalinc/footer.php'); ?>


</body>
</html>

The datatable-responsive.js contains:

$(document).ready(function() {
    $('.dataex-res-configuration').DataTable({
        responsive: true
    });

The call from the included file (localhost:92/portal/portalindex.php?loc=variety&id=varieties) is:

<table class="table table-striped table-bordered dataex-res-configuration">

Thoughts?

Display 'Loading ...' message without using the ajax function of DataTable()

$
0
0

I am currently using the following to populate a page on my site:

$(document).ready(function() {
    $.ajax({
        'url': '/RetrieveData',
        'type': 'POST',
        'dataType': 'json',
        success: function(response) {
            $('#pagefield1').html(response.PageField1);
            $('#pagefield2').html(response.PageField2);
            $('#pagefield3').html(response.PageField3);
            $('#pagefield4').html(response.PageField4);

            numRows = 25;

            table = $('#table1').DataTable({
                'pageLength': numRows,
                'autoWidth': false,
                'data': response.TableData,
                'columns': [
                    { 'data': 'col0', 'name': 'col0' },
                    { 'data': 'col1', 'name': 'col1' },
                    { 'data': 'col2', 'name': 'col2' },
                    { 'data': 'col3', 'name': 'col3' },
                    { 'data': 'col4', 'name': 'col4' }
                ],
                'columnDefs': [
                    { 'visible': false, 'targets': [0] },
                    { 'sortable': false, 'targets': [4] },
                    { 'width': '150px', 'targets': [1] },
                    { 'width': '75px', 'targets': [2, 3] },
                    { 'width': '100px', 'targets': [4] },
                    { 'type': 'currency', 'class': 'cell-right', 'targets': [1] },
                    { 'class': 'cell-center', 'targets': [2, 3] },
                    {
                        'render': function(data, type, row) {
                            return '<span data-tooltip="ID: ' + row.Id + '">' + data + '</span>';
                        },
                        'targets': 1
                    }
                ],
                'order': [
                    [1, 'asc']
                ]
            });
        },
        error: function(xhr, ajaxOptions, thrownError) {
        }
    });
});

The problem I ran into was the area where the table was supposed to be remains blank until the ajax processes and hands data off to the $('#table1').DataTable() function call.

I want to be able to display the table the same way as if there was no data found, but instead of displaying 'No data found' message, I want it to display a 'Loading ...' message.

I have achieved what I was trying to do by adding the following before the above code in the $(document).ready() function and adding a table.destroy(); at line 13 of the above code:

table = $('#taskorders').DataTable({
    'data': [
        {
            'col1':'',
            'col2':'',
            'col3':'Loading ...',
            'col4':''
        }
    ],
    'columns': [
        { 'data': 'col0', 'name': 'col0' },
        { 'data': 'col1', 'name': 'col1' },
        { 'data': 'col2', 'name': 'col2' },
        { 'data': 'col3', 'name': 'col3' },
        { 'data': 'col4', 'name': 'col4' }
    ],
    'columnDefs': [
        { 'visible': false, 'targets': [0] },
        { 'sortable': false, 'targets': [4] },
        { 'width': '150px', 'targets': [1] },
        { 'width': '75px', 'targets': [2, 3] },
        { 'width': '100px', 'targets': [4] },
        { 'type': 'currency', 'class': 'cell-right', 'targets': [1] },
        { 'class': 'cell-center', 'targets': [2, 3] },
        {
            'render': function(data, type, row) {
                return '<span data-tooltip="ID: ' + row.Id + '">' + data + '</span>';
            },
            'targets': 1
        }
    ]
});

I feel there has GOT to be a better way of doing this. Can anyone point me in the right direction??

Editor select2 fix

$
0
0

editor.select2.js - line 214 - change JSON.stingify to JSON.stringify

Thanks for a great product and outstanding documentation.

Apologies for not contributing through github.

:)

After purchase

$
0
0

Hi,

I have purchased an one developper Licence.

What is the way to use the licence? where can I find the "unlocked" sources?

Thanks

MJOIN Server-Side Performance Hit (PHP)

$
0
0

PHP Editor Version 1.6.4

We've encountered an issue with mjoin's causing a massive slowdown on queries (anywhere from 9 - 15 seconds). Initially the work around was to use the ini_set('memory_limit','512M'); trick. While that allowed the function to execute (thus circumventing the "Allowed Memory Size..." error), it takes a very long time to complete. We are using PHP Server Side.

We have a direct link (only a single link) MJOIN on the primary table. This MJOIN links to a table with 378,530 rows of data. The parent table has 121,740 rows of data.

With the MJOIN, this particular query takes 8 seconds. Without the MJOIN, the query takes 549.68ms.

Is this an issue with the library? Is there a way to efficiently speed this up?

Viewing all 81689 articles
Browse latest View live


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