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

upload field type is not working with Bootstrap 4

$
0
0
<div class="col-lg-12">
    <table id="myTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Id</th>
                <th>Year</th>
                <th>Company</th>
                <th>Line</th>
                <th>BaseColor</th>
                <th>BaseDescription</th>
                <th>AccentColor</th>
                <th>AccentDescription</th>
                <th>PartNumber</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
</div>

<script type="text/javascript" charset="utf-8">
    var editor;
        $(document).ready(function () {
                uploadEditor = new $.fn.dataTable.Editor({
            ajax:"{{url_for('adminpanel_uploadcolorstabledata')}}",
            table: "#myTable",
            idSrc: 'Id',
            fields: [
            {
                label: "Upload File:",
                name: "upload_file",
                type: "upload",
                clearText: "Clear",
            },
            ],
        });

$('#myTable').DataTable(
            {
                "processing": true,
                "serverSide": true,
                "ajax": "{{ url_for('adminpanel_colorstabledata')}}",
                dom: 'Blfrtip',
                "columns": [

                    { "data": "Id", "visible": false, "searchable": false },
                    { "data": "Year" },
                    { "data": "Company" },
                    { "data": "Line" },
                    { "data": "BaseColor" },
                    { "data": "BaseDescription" },
                    { "data": "AccentColor" },
                    { "data": "AccentDescription" },
                    { "data": "PartNumber" },
                ],
                order: [1, 'asc'],
                select: {
                    style: 'os',
                    selector: 'td:first-child'
                },
                buttons: [
                    { extend: "create", text:"upload",editor: uploadEditor} ,
                    "colvis",
                    "csv"
                ],
            }
        );
    });
</script>

Description of problem:

When I try to click the choose file button it doesn't open anything to choose file from. By that I meant it doesn't open a file browser in windows. I am not sure what is causing this issue but I might suspect it is a bootstrap 4 issue.

Here are all the stylesheet and javascript libraries I am using:

<head>
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='bootstrap-4.4.1-dist/css/bootstrap.min.css') }}" crossorigin="anonymous">

  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='DataTables-1.10.21/css/dataTables.bootstrap4.min.css') }}"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='Buttons-1.6.2/css/buttons.bootstrap4.min.css') }}" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='Select-1.3.1/css/select.bootstrap4.min.css') }}" crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='ColReorder-1.5.2/css/colReorder.bootstrap4.min.css') }}"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='FixedHeader-3.1.7/css/fixedHeader.bootstrap4.min.css') }}"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='RowReorder-1.2.7/css/rowReorder.bootstrap4.min.css') }}"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='Responsive-2.2.4/css/responsive.bootstrap4.min.css') }}"
    crossorigin="anonymous">

  <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='select2-4.0.13/css/select2.min.css') }}"
    crossorigin="anonymous">

  <link rel="stylesheet" type="text/css"
    href="{{ url_for('static', filename='Editor-1.9.2/css/editor.bootstrap4.min.css') }}" crossorigin="anonymous">
</head>
<script>
<script src="{{ url_for('static', filename='jquery-3.5.1/jquery-3.5.1.min.js') }}" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"
  integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>

<script src="{{ url_for('static', filename='bootstrap-4.4.1-dist/js/bootstrap.min.js') }}"
  crossorigin="anonymous"></script>

<script src="{{url_for('static', filename='DataTables-1.10.21/js/jquery.dataTables.min.js')}}"
  crossorigin="anonymous"></script>
<script src="{{url_for('static', filename='DataTables-1.10.21/js/dataTables.bootstrap4.min.js')}}"
  crossorigin="anonymous"></script>

<script src="{{url_for('static', filename='Select-1.3.1/js/dataTables.select.min.js')}}"
  crossorigin="anonymous"></script>
<Script src="{{url_for('static', filename='FixedHeader-3.1.7/js/dataTables.fixedHeader.min.js')}}"
  crossorigin="anonymous"></Script>
<script src="{{url_for('static', filename='Responsive-2.2.4/js/dataTables.responsive.min.js')}}"
  crossorigin="anonymous"></script>
<Script src="{{url_for('static', filename='ColReorder-1.5.2/js/dataTables.colReorder.min.js')}}"
  crossorigin="anonymous"></Script>
<Script src="{{url_for('static', filename='RowReorder-1.2.7/js/dataTables.rowReorder.min.js')}}"
  crossorigin="anonymous"></Script>

<Script src="{{url_for('static', filename='percentageBars/percentageBars.js')}}" crossorigin="anonymous"></Script>

<script type="text/javascript" src="{{ url_for('static', filename='Editor-1.9.2/js/dataTables.editor.min.js') }}"
  crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ url_for('static', filename='Editor-1.9.2/js/editor.bootstrap4.min.js') }}"
  crossorigin="anonymous"></script>

<script src="{{ url_for('static', filename='Buttons-1.6.2/js/dataTables.buttons.min.js') }}"
  crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='Buttons-1.6.2/js/buttons.bootstrap4.min.js') }}"
  crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='Buttons-1.6.2/js/buttons.colVis.min.js') }}"
  crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='Buttons-1.6.2/js/buttons.html5.min.js') }}"
  crossorigin="anonymous"></script>

<script src="{{ url_for('static', filename='select2-4.0.13/js/select2.min.js') }}" crossorigin="anonymous"></script>
<script src="https://momentjs.com/downloads/moment.js" crossorigin="anonymous"></script>
</script>

Also, I am using flask(python) as a backend but I don't see it as an issue though!


Uncaught Type Error: a is not a function

$
0
0

Dear all,

I created a Editor on my MVC project and got the below running time error after update a record.
The record could be updated but the update panel did not disappear.

dataTables.editor.min.js:110 Uncaught TypeError: a is not a function
at f.edit (dataTables.editor.min.js:110)
at f._dataSource (dataTables.editor.min.js:81)
at f._submitSuccess (dataTables.editor.min.js:99)
at dataTables.editor.min.js:95
at Object.e.complete (dataTables.editor.min.js:76)
at fire (jquery-3.4.1.js:3291)
at Object.fireWith (jquery-3.4.1.js:3421)
at done (jquery-3.4.1.js:9548)
at XMLHttpRequest.<anonymous> (jquery-3.4.1.js:9785)

Server API :
[Route("api/SalesOrderLines/{orderNo}/orderNo")]
[HttpGet]
[HttpPost]

    public IHttpActionResult SalesOrderLines(string orderNo)
    {
        var request = HttpContext.Current.Request;
        var settings = Properties.Settings.Default;
        using (var tcdb = new DataTables.Database(settings.DbType, settings.DbConnection))
        {
            var response = new Editor(tcdb, "data.SalesOrderLine","id")
                .Model<SalesOrderLineEditViewModels>()
                //.Model<EditSalesOrderLineDto>()
                .Where("orderno" ,orderNo,"=")
                .Field(new Field("id"))
                .Field(new Field("partNo")
                .Validator(Validation.NotEmpty())
                )
                .Field(new Field("description")
                .Validator(Validation.NotEmpty())
                )
                .Field(new Field("orderQuantity")
                //.Validator(Validation.Numeric())
                )
                .Field(new Field("unitPrice")
                //.Validator(Validation.Numeric())
                )
                .Field(new Field("amount")
                //.Validator(Validation.Numeric())
                )
               .Field(new Field("requestDate")
                .Validator(Validation.DateFormat(
                       Format.DATE_ISO_8601,
                        new ValidationOpts { Message = "Please enter a date in the format yyyy-mm-dd" }
                    ))
                    .GetFormatter(Format.DateSqlToFormat(Format.DATE_ISO_8601))
                    .SetFormatter(Format.DateFormatToSql(Format.DATE_ISO_8601))
                )
                /*.Field(new Field("requestDate")
                        .Validator(Validation.DateFormat("dd/MM/yy",
                         new ValidationOpts { Message = "Please enter a date in the format dd/MM/yy" }))
                        .GetFormatter(Format.DateSqlToFormat("dd/MM/yy"))
                        .SetFormatter(Format.DateFormatToSql("dd/MM/yy"))
                        )*/
                .Process(request)
                .Data();

            return Json(response);
        }
    }

View Model :

public class SalesOrderLineEditViewModels
{
[EditorTypeError("ID")]
public int id { get; set; }
[EditorTypeError("Order No")]
public string orderNo { get; set; }
[EditorTypeError("Order Type")]
public string orderType { get; set; }
[EditorTypeError("Line No")]
public int lineNo { get; set; }
[EditorTypeError("Part No")]
public string partNo { get; set; }
[EditorTypeError("Description")]
public string description { get; set; }
[EditorTypeError("Order Quantity")]
public int orderQuantity { get; set; }
[EditorTypeError("Open Quantity")]
public int openQuantity { get; set; }
[EditorTypeError("First Order Quantity")]
public int firstOrderQuantity { get; set; }
[EditorTypeError("Unit Price")]
public decimal unitPrice { get; set; }
[EditorTypeError("Amount must be decimal type.")]
public decimal amount { get; set; }
[EditorTypeError("Request date must be in format 'YYYY-MM-DD'.")]
public string requestDate { get; set; }
[EditorTypeError("Status")]
public string status { get; set; }
[EditorTypeError("Customer Part No")]
public string customerPartNo { get; set; }
[EditorTypeError("Sales Order Master ID")]
public int salesOrderMasterId { get; set; }

}

The test case link is as below.

http://live.datatables.net/bozuroze/1/edit?html,css,js,console

Thanks.

Tom

footer select list not showing all options

$
0
0

am trying to achieve these select list in footer
https://datatables.net/examples/api/multi_filter_select.html

I have done it and its working fine but the problem is tht am using datatable pagination with ajax so at first instance the datatable gets only first 10 rows of data. So in footer select list it shows the unique options from ONLY first 10 rows of data..

I want that the select list should have all options of all the unique data from database table.

Knex and MSSQL Stored Procedures

$
0
0

I've successfully installed, and I'm running, the DT Editor/Node libraries with our own production SQL server, using the demo files you've provided, and it's working :smile:

A lot of my work revolves around Stored Procedures.

Would there be a way to expand the example below so that the Fields being established are "bound" to the results of the Stored Procedure? How do I get the "Datatables Node Library" and KNEX to work with the results of the stored procedure?

In my journeys, I have established a "data model" using Express and Sequelize. My Express route uses Sequelize to run a specific Stored Procedure, and the results are returned as JSON.

So, I can create a result set in my Stored Procedure to match the Fields in the example below... but I don't know how to "instantiate" "Editor-Server" instances of those Fields.

KNEX appears to have a "raw" option, so theoretically, I could use it to run a SP: knexjs.org/#Raw

Thank you for any advice you may have.

router.all('/api/staff', async function(req, res) {
    let editor = new Editor(db, 'datatables_demo').fields(
        new Field('first_name').validator(Validate.notEmpty()),
        new Field('last_name').validator(Validate.notEmpty()),
        new Field('position'),
        new Field('office'),
        new Field('extn'),
        new Field('age')
            .validator(Validate.numeric())
            .setFormatter(Format.ifEmpty(null)),
        new Field('salary')
            .validator(Validate.numeric())
            .setFormatter(Format.ifEmpty(null)),
        new Field('start_date')
            .validator(
                Validate.dateFormat(
                    'YYYY-MM-DD',
                    null,
                    new Validate.Options({
                        message: 'Please enter a date in the format yyyy-mm-dd'
                    })
                )
            )
            .getFormatter(Format.sqlDateToFormat('YYYY-MM-DD'))
            .setFormatter(Format.formatToSqlDate('YYYY-MM-DD'))
    );

    await editor.process(req.body);
    res.json(editor.data());
});

Статья N28 о Do Casinos Enhance Crime?

$
0
0

Автор пишет: «Вся мораль смеха, риска, экзальтации доблестей и сил есть не что иное, как дух решимости.

Последние несколько лет отмечены открытием большого количества казино и залов игровых автоматов. Попробовать современное онлайн казино Casino X может каждый желающий прямо сейчас, поскольку есть временной доступ к актуальному зеркалу.

Игровое поведение пациентов можно определить как бесконечную погоню за ранее проигранными деньгами. Штраф, в свою очередь, сопряжен с тем, чтобы извлечь из игровой организованной группы доход в очень крупном размере, они могут быть наказаны в виде наложением штрафа до 1 миллиона рублей, а также могут быть лишены свободы сроком до 6 лет и плюс к этому заплатить штраф около 500 тысяч рублей.
Дополнительные символы - это символы, которые часто появляются на барабанах, чтобы помочь составлять выигрышные комбинации и отличать один слот от другого. Как играть в игровые автоматы? Тогда на очереди - Venetian Macao.
<a href="https://www.adminer.org/redirect/?url=https://elslots-gold.com/">https://www.adminer.org/redirect/?url=https://elslots-gold.com/</a
Уверены, игра поможет вам отлично отдохнуть после тяжелого рабочего дня и снять стресс. Не надо будет переживать, о том, что кто-то может посягнуть на Ваш выигрыш, Вы будете в полной безопасности! Г. Р. Блэйки отмечает, что после открытия в 1978 г.
Одни теории изучают азартное поведение на макроуровне, на уровне социальной структуры, другие - на индивидуальном, на микроуровне, который может включать описание индивидуальных характеристик проблемных игроков, мотивации различных игроков и т. Ведь, если вы не знакомы с механикой слота, правилами и перспективами, всегда существует шанс, что захочется оспорить результаты и потребовать от казино возмещения потерь. В результате выпадающие доходы консолидированного бюджета в 2012 г.

Is it possible to use Blfrtip dom with Editor . i am getting only Blfrtip buttons, not Editor botton

$
0
0
      var editor; 
      $(function () {
       var table= $('#tblusers').DataTable({
          "ajax": {
                        "url": "/users/getdata",
    //                    "type": "GET",
                       ![](https://datatables.net/forums/uploads/editor/eq/aukysodo5whp.jpg "")

                    }, 
            "stateSave": true,
            "aLengthMenu": [[5, 10, 15, 25, 50, 100 ], [5, 10, 15, 25, 50, 100]],
            "processing": true,
            "serverSide": true,
            "pageLength": 25,
            scrollY:        "300px",
    //        scrollX:        true,
            scrollCollapse: true,
            select: true,
    //        fixedColumns: true, 
            dom: 'Blfrtip',
            buttons: [
                {
                    extend: 'copyHtml5',
                    exportOptions: {
                        columns: [ ':visible' ]
                    }
                },
                {
                    extend: 'excelHtml5',
                    exportOptions: {
                        columns: ':visible'
                    }
                },
                {
                    extend: 'pdfHtml5',
                    exportOptions: {
                        columns: [ ':visible' ]
                    }
                },
                {
                    extend: 'csvHtml5',
                    exportOptions: {
                        columns: [ ':visible' ]
                    }
                },

                'colvis',

            ],
            "columns": [
               {"data":"User Name", "name":"username", "width":"20%","searchable":true},
    {"data":"Email", "name":"email", "width":"20%","searchable":true},
    {"data":"Logins", "name":"login_count", "width":"10%","searchable":true},
    {"data":"Created", "name":"created", "width":"10%","searchable":true},
    {"data":"Last Login", "name":"last_login", "width":"20%","searchable":true},
    {"data":"Active", "name":"active", "width":"10%","searchable":true},
    {"data":"Phone", "name":"phone", "width":"10%","searchable":true},

               {
                        "data": null,
                        "sortable": false,
                        "searchable": false,
                        "orderable": false, 
                        "targets": 0 ,
                        'printable':false,
                        'exportable':false,
                        "render": function(data, type, full) {
                         return ' <div class="dropdown">  <button type="button" class="btn btn-secondary btn-sm  dropdown-toggle" data-toggle="dropdown">Action</button>  <div class="dropdown-menu">    <a name="edit" class="dropdown-item" href="#"><i class="fas fa-edit"> </i> Edit</a>    <a name="delete" class="dropdown-item" href="#"><i class="fas fa-trash"> </i> Delete</a>  </div></div>';
                        }
                },
            ],

            }); //End of dT.
        //https://editor.datatables.net/examples/styling/bootstrap
         editor = new $.fn.dataTable.Editor( {
            ajax: "../php/staff.php",
            table: "#tblusers",
            fields: [ {
                    label: "Username:",
                    name: "username"
                }, {
                    label: "Email:",
                    name: "email"
                }, {
                    label: "Phone:",
                    name: "phone"
                }
            ]
        } );

       // Display the buttons
        new $.fn.dataTable.Buttons( table, [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ] );

       table.buttons().container()
            .appendTo( $('.col-md-6:eq(0)', table.table().container() ) );

is DT Editor &with BS 4.x compatible with AdminLte 3.x

$
0
0

I am not getting below window while trying to edit the row by simulating the same data from your site hosting locally.

but, i am not able to lick the X button to close the modal. i need to press Esc to get it cancelled.

can i do some kind of library inclusion to fix it.

below are my js and css.

<    !-- jQuery -->
    <script src="/plugins/jquery/jquery.min.js"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="/plugins/jquery-ui/jquery-ui.min.js"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
      $.widget.bridge('uibutton', $.ui.button)
    </script>
    <!-- Bootstrap 4 -->
    <script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- ChartJS -->
    <script src="/plugins/chart.js/Chart.min.js"></script>
    <!-- Sparkline -->
    <script src="/plugins/sparklines/sparkline.js"></script>
    <!-- JQVMap -->
    <script src="/plugins/jqvmap/jquery.vmap.min.js"></script>
    <script src="/plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
    <!-- jQuery Knob Chart -->
    <script src="/plugins/jquery-knob/jquery.knob.min.js"></script>
    <!-- daterangepicker -->
    <script src="/plugins/moment/moment.min.js"></script>
    <script src="/plugins/daterangepicker/daterangepicker.js"></script>
    <!-- Tempusdominus Bootstrap 4 -->
    <script src="/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
    <!-- Summernote -->
    <script src="/plugins/summernote/summernote-bs4.min.js"></script>
    <!-- overlayScrollbars -->
    <script src="/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
    <!-- AdminLTE App -->
    <script src="/js/adminlte.js"></script>
    <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
    <script src="/js/pages/dashboard.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="/js/demo.js"></script>
    
    <script src="/plugins/toastr/toastr.min.js"></script>

<!-- //DataTables-->

 <script  src="/plugins/DataTables/datatables.min.js"></script>
 
  <!--<script src="/plugins/DataTables/DataTables-1.10.21/js/jquery.dataTables.min.js"></script>-->
 <script src="/plugins/DataTables/Select-1.3.1/js/select.bootstrap4.js"></script>
 <!--<script src="/plugins/DataTables/Buttons-1.6.3/js/dataTables.buttons.min.js"></script>--> 
 
 <script src="/plugins/DataTables/Buttons-1.6.3/js/buttons.bootstrap4.min.js"></script>
 <script src="/plugins/DataTableEditor/js/dataTables.editor.js"></script>
 <script src="/plugins/DataTableEditor/js/editor.bootstrap4.min.js"></script>



CSS: 

    <link rel="stylesheet" href="/plugins/fontawesome-free/css/all.min.css">
      <!-- Ionicons -->
      <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
      <!-- Tempusdominus Bbootstrap 4 -->
      <link rel="stylesheet" href="/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
      <!-- iCheck -->
      <link rel="stylesheet" href="/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
      <!-- JQVMap -->
      <link rel="stylesheet" href="/plugins/jqvmap/jqvmap.min.css">
      <!-- Theme style -->
      <link rel="stylesheet" href="/css/adminlte.min.css">
      <!-- overlayScrollbars -->
      <link rel="stylesheet" href="/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
      <!-- Daterange picker -->
      <link rel="stylesheet" href="/plugins/daterangepicker/daterangepicker.css">
      <!-- summernote -->
      <link rel="stylesheet" href="/plugins/summernote/summernote-bs4.css">
      
      <link rel="stylesheet" href="/plugins/toastr/toastr.min.css">
      
      
      <!--//DataTables-->
    
       <link rel="stylesheet" href="/plugins/DataTables/datatables.min">
       <link rel="stylesheet" href="/plugins/DataTables/DataTables-1.10.21/css/dataTables.bootstrap4.min.css">
       <!--<link rel="stylesheet" href="/plugins/DataTables/FixedColumns-3.3.1/css/fixedColumns.bootstrap4.min.css">--> 
        <!--<link rel="stylesheet" href="/plugins/DataTables/Select-1.3.1/css/select.bootstrap4.min.css">--> 
        <link rel="stylesheet" href="/plugins/DataTables/Buttons-1.6.3/css/buttons.bootstrap4.min.css"> 
        <link rel="stylesheet" href="/plugins/DataTables/DataTables-1.10.21/css/jquery.dataTables.min.css"> 
        <link rel="stylesheet" href="/plugins/DataTableEditor/css/editor.dataTables.min.css"> 
        <link rel="stylesheet" href="/plugins/DataTableEditor/css/editor.bootstrap4.min.css">  

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Can not trigger column(s) visibility.

$
0
0

Fairly new to all of this so patience and help appreciated.

I have a table working, as well as this code here:

$('#leadTable').on( 'length.dt', function ( e, settings, len ) {setTimeout(bindME,2000);});

$('#leadTable').on( 'page.dt', function () {setTimeout(bindME,1000);});

What I am wanting to do is a create an event that upon clicking an element, hide columns 6,7,8,9 in my table.

I tried the example code on this page - https://datatables.net/examples/api/show_hide.html

But I seem to get nowhere. I have a variable for my table called "tommy" -

`

var tommy = $("#callsTable").dataTable({
    searchPane: {
        columns: [':contains("Market")'], threshold: 0
    },
    "order": [],
    "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
    "columnDefs": [
        { "visible": false, "targets": 9, "searchable": true, "orderable": true },
        { "visible": false, "targets": 10, "searchable": true, "orderable": true },
        { "visible": false, "targets": 11, "searchable": true, "orderable": true },     
        { "visible": false, "targets": 12, "searchable": false, "orderable": false }

        //{ "visible": false, "targets": 15 },
        // { "visible": true, "targets": 0, "searchable": true }
    ],
    "language": {
        "lengthMenu": "_MENU_ Rows",
        "searchPlaceholder": "Search Client Leads",
        "info": "Rows _START_ to _END_ of _TOTAL_"
    },
    "oLanguage": {
        "sSearch": "<i class='fal fa-search fa-1ax'></i>"
    },
    //colReorder: true,
    dom: "<'#cLeads.row be-datatable-header'lfBi>" +
        "<'row be-datatable-body'<'col-sm-12'tr>>" +
        "<'row be-datatable-footer'<'col-sm-12'p>>",
    buttons: [
        { extend: 'colvis', text: 'Columns' },
        {
            extend: 'collection',
            text: 'Export',
            buttons: [
                'excel',
                'csv',
                'pdf',
                'print'
            ]
        }

    ]
});

`
But this code gets me nowhere

$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();

    // Get the column API object
    var column = tommy.column( $(this).attr('data-column') );

    // Toggle the visibility
    column.visible( ! column.visible() );
} );

Searchpane nightly - Maximum call stack size exceeded

$
0
0

Hi,

Bit of a difficult one to reproduce on the debug site. This is an internal web page, getting the data via ajax. All the datatable files are the stable release except for searchpanes which is on nightly.

Searchpanes is setup with cascade true, the issue only occurs with cascade enabled. It also only occurs on the nightly build, switching back to the stable release is fine.

For the most part I can select various options in the searchpane and it'll work fine but occasionally I will select something, cascade kicks in and the figures are updated in the searchpane, however the main datatable doesn't filter. I'll get the following error in the console:
Uncaught RangeError: Maximum call stack size exceeded
at String.replace (<anonymous>)
at V (jquery-3.4.1.min.js:2)
at Function.style (jquery-3.4.1.min.js:2)
at jquery-3.4.1.min.js:2
at _ (jquery-3.4.1.min.js:2)
at _ (jquery-3.4.1.min.js:2)
at k.fn.init.css (jquery-3.4.1.min.js:2)
at _fnCalculateColumnWidths (jquery.dataTables.js:5651)
at _fnAdjustColumnSizing (jquery.dataTables.js:2139)
at _fnScrollDraw (jquery.dataTables.js:5257)

One it has errored, the searchpane will sort of work, with some columns updating their cascaded totals, others won't. The main datatable won't update. Filters that did work no longer do anything, and it just stops until you do a refresh. One you know what selection breaks it, it is repeatable. I'm guessing there is some data that is breaking a function above.

Using the nightly build for the time being as the stable has issues with preselect, it highlights the option in searchpane, but doesn't actually apply the filter to the datatable.

Do I need to attempt to get this into the debug site?

Fixed columns extension, translation not working with ngxtranslate angular

$
0
0

I am using angular datatable with ngxtranslate for translating the headers like below,

    **<thead>
            <tr *ngIf="dtOptions.complexHeader" class="complex-grid-header">
                <th *ngFor="let header of dtOptions.complexHeader; let i = index" [attr.colspan]="header.colspan" [ngClass]="{'emptyHeader': !header.label}" class="complex-header-{{i}}" translate>{{header.label}}</th>
            </tr>
            <tr>
                <th *ngFor="let col of dtOptions.columns" translate>
                    {{col.title | translate}}
                </th>
            </tr>
        </thead>**

When I am adding fixed columns extension, the header is not translated.
Is there any way to do that?

How do you show select inputs filtering drop down bar for columns that are hidden by default?

$
0
0

Hello, I'm very new to datatables and coding for that matter so please forgive my writing and terminology. I'm still learning. I have been trying my best to put together an in depth filtering library for a school district resource project for the community through all the examples everyone has provided. So far I have: https://codepen.io/mmapsesd/pen/NWNbOLj

I have a bunch of columns that doesn't need to be initially be displayed so I was able to hide it with:
columnDefs: [
{targets:[4,5,6,7], visible: false

However now when I turn these columns back on to be visible within the 'Colvis" toolbar, the columns no longer have the individual column searching select input. It just displays the header title again instead of the drop down. How do I fix this?

Lastly is there also a way to display my "Features" column to be wrapped (on multiple lines within a smaller column) vs 1 long line (wide column) and is there a way to have the individual column searching select input to just recognize and show the hyperlink in the drop down list versus the whole entire paragraph? Thank you so much for your help!

Mjoin and 1-1 relationships based on field value

$
0
0

Hi

I am trying to get Editor to save selected data by user to 3 tables: GlobalSubsPacks, GlobalSubsPacksRelations, GlobalPacksDataParam

Here's my Model, how they relate and their respective fields:

GlobalSubsPacks:
ID

GlobalSubsPacksRelations (one GlobalSubsPacks to many GlobalSubsPacksRelations):
ID
SubPackType
ParamType
SubPackID stores GlobalSubsPacks.ID
ParamID stores GlobalPacksDataParam.ID

GlobalPacksDataParam (one GlobalPacksDataParam to one GlobalSubsPacks):
ID
MaximumUsageAllowed (decimal type)

GlobalSubsPacksRelations is a link table that holds a one to many relationship with other tables in my code elsewhere (GlobalSubsPacksRelations.ParamType != 1 if you like). However in the code below where GlobalSubsPacksRelations.ParamType = 1 the relationship is one to one with GlobalPacksDataParam. Can I avoid using an MJoin here since for GlobalPacksDataParam relation is 1-1. I tried using code #1 below but get error 'Unable to cast object of type 'System.Decimal' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'.' which is to be expected since an object is returned rather than a variable. However I get no data back from the server if I use code #2 below.

    HttpRequest formData = HttpContext.Current.Request;

    using (Database db = new Database(SetGetDbType2, SetGetDbConnection))
    {
        editor = new Editor(db, "GlobalSubsPacks", "GlobalSubsPacks.id").Model<SubsPacksDBModel.GlobalSubsPacks>("GlobalSubsPacks");
        editor.Field(new Field("GlobalSubsPacks.id")
            .Set(false)
        );

        Server code #1:
        editor.MJoin(new MJoin("GlobalPacksDataParam")
            .Model<SubsPacksDBModel.GlobalPacksDataParam>()
            .Name("GlobalPacksDataParam")
            .Link("GlobalSubsPacks.id", "GlobalSubsPacksRelations.SubPackID")
            .Link("GlobalPacksDataParam.id", "GlobalSubsPacksRelations.ParamID")
            .Where(q =>
                q.Where("GlobalSubsPacksRelations.ParamType", 1, "=")
            )
            .Order("GlobalPacksDataParam.id ASC")
            .Field(new Field("GlobalPacksDataParam.MaximumUsageAllowed")
                .GetFormatter((val, data) => CommonUtilities.IsNullOrEmpty(val) == true ? 0 : val)
                .Validator(Validation.Numeric())
                .SetFormatter((val, data) => CommonUtilities.IsNumeric(val) == false ? 0 : val)
            )
        );

        Server code #2:
        editor.Field(new Field("GlobalPacksDataParam.MaximumUsageAllowed")
            .GetFormatter((val, data) => CommonUtilities.IsNullOrEmpty(val) == true ? 0 : val)
            .Validator(Validation.Numeric())
            .SetFormatter((val, data) => CommonUtilities.IsNumeric(val) == false ? 0 : val)
        );
        editor.LeftJoin("GlobalSubsPacksRelations", "GlobalSubsPacksRelations.SubPackID", "=", "GlobalSubsPacks.id");
        editor.LeftJoin("GlobalPacksDataParam", "GlobalSubsPacksRelations.ParamID", "=", "GlobalPacksDataParam.id");            
   }

   editor.TryCatch(false);
   editor.Debug(true);
   editor.Process(formData);   

Any help would be welcome.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Add an option to scroller to leave the already loaded rows

$
0
0

I know about the pipelining, but this does not seem to work well with scroller (I don't want pages itself)

I also know you're going to say: for n rows you don't need scroller.
To that I say: yes the browser can handle it, that does not mean the server can load them as fast from the database nor does it fix the extra delay you have because the response is heavier.

I just want everything to be snappy and this would solve 2 problems for me:
- faster scrolling when going back
- no shifting while scrolling when some rows have a different count in lines
- maybe less problems selecting multiple rows over extra draws

Thanks

Unable to get row data after first AJAX call, nested tables.

$
0
0

I am having trouble retrieving row data after the first successful call. I am getting the "Cannot read property 'blah' of undefined". I am guessing that this is a caching related issue but have no idea how to fix this or proceed, any help will be very welcome! Thanks.

    function getMarkerData() {
        var childTable;
        var classes = $('#searchClasses').val();
        var lats = [];
        var lons = [];
        markers.forEach(function(marker) {
            var markerlatlon = marker.getLatLng();
            lats.push(markerlatlon.lat);
            lons.push(markerlatlon.lng);
        });
        showDataTable();
        if ($('#datatable3').text().length != 0) {
            var DT3 = $('#datatable3').text();
            console.log(DT3);
            $(DT3).DataTable().destroy();
        }
        if ($('#datatable2').text().length != 0) {
            var DT2 = $('#datatable2').text();
            console.log(DT2);
            $(DT2).DataTable().destroy();
        }
        if ($.fn.DataTable.isDataTable('#postcodeData')) {
            $('#postcodeData').DataTable().rows().invalidate();
            $('#postcodeData').DataTable().destroy();
        }
        console.log();
        var table = $('#postcodeData').DataTable({
            'ajax' : {
                'url' : '/admin/postcodesearches/_get_searches',
                'type' : 'POST',
                'data' : {
                    classes : classes,
                    lats : lats,
                    lons : lons
                },
                'dataSrc' : ''
            },
            'columns' : [
                {
                    'className' : 'details-control',
                    'orderable' : false,
                    'data' : null,
                    'defaultContent' : '',
                    'render' : function() {
                        return '<i class="fa fa-plus-square" aria-hidden="true"></i>';
                    },
                    'width' : '15px'
                },
                {'data' : 'postcode'},
                {'data' : 'Total5'},
                {'data' : 'Total10'},
                {'data' : 'Total20'},
                {'data' : 'comp_count'}
            ],
            "order": [[1, 'asc']]
        });
        $('#postcodeData tbody').on('click', 'td.details-control', function() {
            var tr = $(this).closest('tr');
            var tdi = tr.find("i.fa");
            var row = table.row(tr);
            var rowData1 = row.data();
            if (row.child.isShown()) {
                row.child.hide();
                tr.removeClass('shown');
                $('#pt' + rowData1.postcode).DataTable().destroy();
                tdi.first().removeClass('fa-minus-square');
                tdi.first().addClass('fa-plus-square');
            }
            else {
                row.child(formatPrimary(rowData1)).show();
                var postcode = rowData1.postcode;
                var childTableID = '#pt' + postcode
                childTable = $(childTableID).DataTable({
                    dom : 't',
                    ajax : {
                        url : '/admin/postcodesearches/_get_nested_searches',
                        type : 'POST',
                        data : {
                            postcode : postcode,
                            class_id : rowData1.parent_ids,
                            df_type : 'PRIMARY'
                        },
                        dataSrc : ''
                    },
                    columns : [
                        {
                            className : 'details-control1',
                            orderable : false,
                            data : null,
                            defaultContent : '',
                            render : function() {
                                return '<i class="fa fa-plus-square" aria-hidden="true"></i>';
                            },
                            width : '15px'
                        },
                        { data : 'class_name'},
                        { data : 'Total5'},
                        { data : 'Total10'},
                        { data : 'Total20'},
                        { data : 'comp_count'}
                    ],
                    select : false,
                    order : [[1, 'asc']]
                });
                tr.addClass('shown');
                tdi.first().removeClass('fa-plus-square');
                tdi.first().addClass('fa-minus-square');
                $('#datatable2').html(childTableID);
            }
        });
        $('tbody').on('click', 'td.details-control1', function() {
            var tr = $(this).closest('tr');
            var tdi2 = tr.find("i.fa");
            var row = childTable.row(tr);
            var rowData2 = row.data();
            if (row.child.isShown()) {
                row.child.hide();
                tr.removeClass('shown');
                $('#ct' + rowData2.parent_id_).DataTable().destroy();
                tdi2.first().removeClass('fa-minus-square');
                tdi2.first().addClass('fa-plus-square');
            }
            else {
                row.child(formatClass(rowData2)).show();
                var parent_id = rowData2.parent_id_;
                var childTable2ID = '#ct' + parent_id
                childTable2 = $(childTable2ID).DataTable({
                    dom : 't',
                    ajax : {
                        url : '/admin/postcodesearches/_get_nested_searches',
                        type : 'POST',
                        data : {
                            postcode : rowData2.postcode,
                            class_id : parent_id,
                            df_type : 'CLASS'
                        },
                        dataSrc : ''
                    },
                    columns : [
                        {
                            className : '',
                            orderable : false,
                            data : null,
                            defaultContent : ''
                        },
                        { data : 'class_name' },
                        { data : 'Total5' },
                        { data : 'Total10' },
                        { data : 'Total20' },
                        { data : 'comp_count' }
                    ],
                    select : false,
                    order : [[1, 'asc']]
                });
                tr.addClass('shown');
                tdi2.first().removeClass('fa-plus-square');
                tdi2.first().addClass('fa-minus-square');
                $('#datatable3').html(childTable2ID);
            }
        });
    }
</script>

Trying multicolumn server side at automatic row generate


Update only one column data on call of an event somewhere in page, don't want to reload whole data..

$
0
0

My data table is getting data from a ajax call response, I want to update only one column data on call of an event, just that column data should be reloaded, Not the whole data as it's a big table and reloading whole data again n again will affect my page performance.

Hide / Show columns doesn't take into account my second "tr" header

$
0
0

Hi,

I added to my datatable a second tr in my header, to be able to add a search field for each column. (I didn't want it down in the footer.) Everything works perfectly fine. I then implemented the 'columnsToggle' to be able to see / hide columns. It also works, except ... it doesn't take my research cell into consideration. Let me explain: if I hide the status, it removes the status column, but not the associated search field! So it gives me a shift on the other columns ...

Screenshot of my table :

Then when I click on "Statut" :

As you can see, the "status" column has disappeared but not the associated empty cell ... and suddenly my "title" column now has the associated empty field instead of its search field.

Here is my code :

<script>
    $('#events').initDataTables({{ datatable_settings(datatable) }}, { 
        processing: true,
        serverSide: true,
        searching: true, 
        ordering: false,
        searchDelay: 200,
        dom: 'Bfrtip',
        buttons: [
            {
                text: 'Réinitialiser',
                action: function (e, dt, node, config) {
                    location.reload();
                }
            },
            {
                "extend": 'columnsToggle',
                "columns": [0, 1, 2, 3, 4, 5, 6, 7, 8]
            }
        ],
        initComplete: function(settings, json) {
            var api = this.api();
            var recordsTotal = api.context[0].fnRecordsTotal();
            $('#events_list h5 span').text(recordsTotal);

            // Create tr filter
            var tr = $('<tr id="filter_search"></tr>');
            // Count number of cells in a row
            var nbCells = document.getElementById('dt').rows[0].cells.length;
            // Generate cells to #filter_search row 
            for (var i = 0; i < nbCells; i++) {
                if (i == 1 || i == 7 || i == 9) {
                    tr.append('<th></th>');
                } else {
                    tr.append('<th><input type="search" onclick="stopPropagation(event);" placeholder="Rechercher"></th>');
                }

            }

            var firstHeaderRow = $('tr', api.table().header());
            tr.insertAfter(firstHeaderRow);

            $("#filter_search input").on('keyup change', function(e) {
                if (e.keyCode == 13) {
                    api
                        .column($(this).parent().index()+':visible')
                        .search(this.value)
                        .draw();
                }
            });
        },
        drawCallback: function(settings) {
            var api = this.api();
            var info = api.page.info();
            var recordsDisplay = info.recordsDisplay;
            $('#events_list h5 span').text(recordsDisplay);
        },
        language: {
            emptyTable:     "Aucune donnée disponible",
            info:           "Affichage de _START_ à _END_ sur _TOTAL_ entrées",
            infoEmpty:      "Affichage de 0 à 0 sur 0 entrées",
            infoFiltered:   "(filtré de _MAX_ entrées au total)",
            lengthMenu:     "Affichage de _MENU_ entrées",
            loadingRecords: "Chargement...",
            processing:     "En traitement...",
            search:         "Recherche : ",
            searchPlaceholder: "Chercher un id, un titre, une ville, ...",
            zeroRecords:    "Aucun enregistrements correspondants trouvés",
            paginate: {
                first:      "Premier",
                last:       "Dernier",
                next:       "Suivant",
                previous:   "Précédent"
            },
        }
    });

    function stopPropagation(evt) {
        if (evt.stopPropagation !== undefined) {
            evt.stopPropagation();
        } else {
            evt.cancelBubble = true;
        }
    }
</script>

I use Symfony DataTables Bundle from Omines.

The table is generated automatically via this bundle.

Here is the html structure :

How to use Editor with Express and EJS and update object without DB

$
0
0

Hi,
I'm a bit new using Editor and I can't find a way to solve my problem.
I'm using Node Js with Express JS and EJS to develop an app that instead of using a database, uses objects that are passed to the EJS templates. I want to know if it's possible to use the Editor inside one table and then whenever the user edits any row, the object related with this row updates its values automatically and the if I need to use the object for any other operation, the object values are always updated in both, client and server side.

Thanks.

Excel cell formatting - How can we iterate excel export rows and get the cell value dynamically??

$
0
0

// Loop over the cells in column C
$('row c[r^="C"]', sheet).each( function () {
// Get the value
if ( $('is t', this).text() == 'New York' ) {
$(this).attr( 's', '20' );
}
});
In this example,they are looping over cells in 'C' column..how can we get this column A,B,C,D .... index position dynamically without specifying it??

Populating the table with RAWSQL query

$
0
0

I am using the raw sql query below to populate some columns in the datatble which is already created using Editor data-tables. I am not sure if I am doing it correctly. I believe that the** if ( ! isset( $_POST['action'] ) ) {** is not working as it should work.

How should the JSON response look like?

In my case I would like JSON to contain all the data 1) From RAW sql to populate few columns and 2) From Editor to populate renaming columns (else condition).

p.s i tried to remove the if condition so i can read all the data in one JSON and then handle them differently on client side but it is showing me** Error: Parse error**

**// if ( ! isset( $_POST['action'] ) ) {
   $rawquery = "SELECT start  AS time 
                FROM contract_bal";
   $data = $db->sql( $rawquery )->fetchAll();
   echo json_encode( array(
      'data' => $data
   ) );
 
// }else{
......editor stuff
}**    

and on the client side i included this:

**columns[
......
 
                     { data: "time" }
.....
]**
Viewing all 82572 articles
Browse latest View live


Latest Images

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