Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

Recent Discussions — DataTables forums

older | 1 | .... | 2249 | 2250 | (Page 2251) | 2252 | 2253 | .... | 2326 | newer

    0 0

    Hello,

    after upgrading to 1.8.0 this code does not work anymore.

    error: An SQL error occurred: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'CMDB_Asset.id' in 'field list'

    <?php
    require_once '../../../../configs/main.php';
    require_once '../../../../libs/datatables-editor/lib/DataTables.php';
    
    use DataTables\Editor;
    use DataTables\Editor\Field;
    use DataTables\Editor\Mjoin;
    use DataTables\Editor\Options;
    use DataTables\Editor\Upload;
    use DataTables\Editor\Validate;
    
    if ($_SESSION['login']['login_ok'] == 1) {
        Editor::inst($dbIntranet, 'CMDB_Asset')
            ->debug(false)
            ->fields(
                Field::inst('CMDB_Asset.id')->set(false),
                Field::inst('CMDB_Asset_Dms.id')->set(false),
                Field::inst('CMDB_Asset_Dms.Name'),
                Field::inst('CMDB_Asset_Dms.Note'),
                Field::inst('CMDB_Status.Name'),
                Field::inst('XRM_Company.id'),
                Field::inst('V_CMDB_Asset.ci')->set(false),
                Field::inst('CMDB_Asset_Dms.DateUpdated')
                    ->getFormatter('Format::datetime', array(
                        //'from' => 'Y-m-d H:i:s',
                        'from' => 'Y-m-d H:i:s',
                        'to'   => 'd.m.Y',
                    )),
                Field::inst('CMDB_Asset_Dms.ChangedBy')
                    ->setValue($_SESSION['login']['userid'])
                    ->validator('Validate::notEmpty'),
                Field::inst('CMDB_V_ProductCatalogSub.NameShort'),
                Field::inst('CMDB_V_ProductCatalogSub.Name'),
                Field::inst('CMDB_Asset_Dms.cmdb_productcatalogsub_id')
                    ->options(Options::inst()
                            ->table('CMDB_V_ProductCatalogSub')
                            ->value('id')
                            ->label('Name')
                    )
                    ->validator('Validate::dbValues')
                    ->validator('Validate::notEmpty'),
    
                Field::inst('CMDB_Asset.cmdb_status_id')
                    ->options(Options::inst()
                            ->table('CMDB_Status')
                            ->value('id')
                            ->label('Name')
                    )
                    ->validator('Validate::dbValues')
                    ->validator('Validate::notEmpty'),
    
                Field::inst('XRM_Company.Name'),
                Field::inst('CMDB_Asset.xrm_company_id')
                    ->options(Options::inst()
                            ->table('XRM_Company')
                            ->value('id')
                            ->label('Name')
                    )
                    ->validator('Validate::dbValues')
                    ->validator('Validate::notEmpty'),
    
                Field::inst('CMDB_Asset_Type.Name'),
                Field::inst('CMDB_Asset.cmdb_asset_type_id')
                    ->options(Options::inst()
                            ->table('CMDB_Asset_Type')
                            ->value('id')
                            ->label('Name')
                    )
                    ->validator('Validate::dbValues'),
                Field::inst('CMDB_Asset_DmsCategory.Name'),
                Field::inst('CMDB_Asset_Dms.cmdb_asset_dmscategory_id')
                    ->options(Options::inst()
                            ->table('CMDB_Asset_DmsCategory')
                            ->value('id')
                            ->label('Name')
                    )
                    ->validator('Validate::dbValues')
                    ->validator('Validate::notEmpty')
    
            )
            ->leftJoin('CMDB_Asset_Dms', 'CMDB_Asset_Dms.cmdb_asset_id', '=', 'CMDB_Asset.id')
            ->leftJoin('XRM_Company', 'XRM_Company.id', '=', 'CMDB_Asset.xrm_company_id')
            ->leftJoin('CMDB_Status', 'CMDB_Status.id', '=', 'CMDB_Asset.cmdb_status_id')
            ->leftJoin('CMDB_Asset_Type', 'CMDB_Asset_Type.id', '=', 'CMDB_Asset.cmdb_asset_type_id')
            ->leftJoin('CMDB_V_ProductCatalogSub', 'CMDB_V_ProductCatalogSub.id', '=', 'CMDB_Asset_Dms.cmdb_productcatalogsub_id')
            ->leftJoin('CMDB_Asset_DmsCategory', 'CMDB_Asset_DmsCategory.id', '=', 'CMDB_Asset_Dms.cmdb_asset_dmscategory_id')
            ->leftJoin('V_CMDB_Asset', 'V_CMDB_Asset.id', '=', 'CMDB_Asset.id')
            ->join(
                Mjoin::inst('CMDB_Asset_Dms_File') //many-to-many
                    ->link('CMDB_Asset.id', 'CMDB_Asset_Dms_Link_File.cmdb_asset_id')
                    ->link('CMDB_Asset_Dms_File.id', 'CMDB_Asset_Dms_Link_File.cmdb_asset_dms_file_id')
                    ->fields(
                        Field::inst('id')
                            ->upload(Upload::inst($_SERVER['DOCUMENT_ROOT'] . '/cxintranet_cms/dms/__ID___' . mt_rand() . '.__EXTN__')
                                    ->db('CMDB_Asset_Dms_File', 'id', array(
                                        'DateCreated' => Upload::DB_READ_ONLY,
                                        'Filename'    => Upload::DB_FILE_NAME,
                                        'Filesize'    => Upload::DB_FILE_SIZE,
                                        'WebPath'     => Upload::DB_WEB_PATH,
                                        'SystemPath'  => Upload::DB_SYSTEM_PATH,
                                    ))
                                    ->validator(Validate::fileSize(10485760, 'Max. Dateigröße: 10MB'))
                                    ->validator(Validate::fileExtensions(array('pdf', 'txt', 'lic', 'doc', 'docx', 'xls', 'xlsx', 'html'), "Erlaubte Dateitypen: pdf, txt, lic, doc, docx, xls, xlsx, html"))
                            )
                    )
            )
            ->where('CMDB_Asset_Type.id', 31)
            ->process($_POST)
            ->json();
    }
    
    
    $(function() {
        //editor
        var editor;
        editor = new $.fn.dataTable.Editor({
            ajax: "ajax/cmdb/assets/dms/processData.php",
            table: "#table_[@ID UID]",
            fields: [{
                    label: "ID:",
                    name: 'V_CMDB_Asset.ci',
                    type: 'readonly'
                }, {
                    label: "Firma:",
                    name: "CMDB_Asset.xrm_company_id",
                    opts: {
                        multiple: false,
                        placeholder: 'Firma auswählen'
                    },
                    "type": "select2"
                }, {
                    label: "Kategorie:",
                    name: "CMDB_Asset_Dms.cmdb_asset_dmscategory_id",
                    opts: {
                        multiple: false,
                        placeholder: 'Kategorie auswählen'
                    },
                    "type": "select2"
                }, {
                    label: "Notiz:",
                    name: 'CMDB_Asset_Dms.Note',
                    "type": "ckeditorClassic"
                }, {
                    label: "Dateien:",
                    name: "CMDB_Asset_Dms_File[].id",
                    type: "uploadMany",
                    display: function(fileId, counter) {
                        return '<a href="' + editor.file('CMDB_Asset_Dms_File', fileId).WebPath + '" target="_blank">' + moment(editor.file('CMDB_Asset_Dms_File', fileId).DateCreated).format('DD.MM.YYYY') + ' | ' + editor.file('CMDB_Asset_Dms_File', fileId).Filename + '</a>';
                    },
                    noFileText: 'keine Dateien'
                }, {
                    label: "Status:",
                    name: "CMDB_Asset.cmdb_status_id",
                    opts: {
                        multiple: false,
                        placeholder: 'Status auswählen'
                    },
                    type: "select2"
                }, {
                    label: "(Optional) Produkt:",
                    name: "CMDB_Asset_Dms.cmdb_productcatalogsub_id",
                    opts: {
                        multiple: false,
                        placeholder: 'Produkt auswählen'
                    },
                    type: "select2",
                    def: function() {
                        return 1
                    },
                }, {
                    label: "Typ:",
                    name: "CMDB_Asset.cmdb_asset_type_id",
                    type: "select"
                },
            ]
        });
        //Sortieren
        $.fn.dataTable.moment('DD.MM.YYYY');
        //datatable
        var table = $('#table_[@ID UID]').DataTable({
            "lengthMenu": [
                [10, 25, 50, 75, 100, 150, 200, 300, -1],
                [10, 25, 50, 75, 100, 150, 200, 300, "All"]
            ],
            "columnDefs": [{
                responsivePriority: 2,
                targets: 0
            }],
            "order": [
                [1, 'desc']
            ],
            "scrollX": false,
            "searchPane": true,
            fixedHeader: {
                headerOffset: 43
            },
            responsive: true,
            ajax: 'ajax/cmdb/assets/dms/processData.php',
            dom: 'Bflrtip',
            columns: [{
                data: null
            }, {
                data: 'CMDB_Asset_Dms.DateUpdated'
            }, {
                data: 'V_CMDB_Asset.ci'
            }, {
                data: 'XRM_Company.Name',
                editField: 'CMDB_Asset.xrm_company_id'
            }, {
                data: 'CMDB_Asset_Dms.Name'
            }, {
                data: 'CMDB_Status.Name',
                editField: 'CMDB_Asset.cmdb_status_id'
            }, {
                data: null,
                className: "center",
                defaultContent: '<a href="" class="editor_edit">Edit</a>'
            }, ],
            select: {
                style: 'os',
                //selector: 'td:first-child'
            },
            buttons: [{
                    extend: 'create',
                    editor: editor,
                    text: 'neu'
                }, {
                    extend: 'edit',
                    editor: editor,
                    text: 'anzeigen/bearbeiten',
                    formButtons: [{
                        label: 'abbrechen',
                        fn: function() {
                            this.close();
                        }
                    }, 'speichern'],
                    formOptions: [{
                        focus: null,
                    }],
                },
            ]
        });
    
    });
    

    0 0

    Hi guys,
    I have a problem with datatable, server-side processing.
    I have a lot of data, so server-side processing is needed to display them properly.
    The first rendering of the datatable is ok, but when I try to change order by column I'm stuck at "processing", sever side call is done properly, data are returned, but nothing happens on the already displayed table.

    This is my code, any help?

    $('#tbl_orders').dataTable({
                "processing": true,
                "serverSide": true,
                "ajax": {
                    "url": "ajax.php?act=Orders&method=GetOrders"
                    , "contentType": "application/json; charset=utf-8"
                    , "dataType": 'json'
                    , "dataSrc": function ( json ) {
                        json.draw = json.data.draw;
                        json.recordsTotal = json.data.recordsTotal;
                        json.recordsFiltered = json.data.recordsFiltered;
                        return json.data.data;
                    }
                    , "dataFilter": function(reps) {
                        return reps;
                    }, "error":function(err){
                        console.log(err);
                    }
                }
                , "order": [[ 1, "desc" ]]
                , "columns": [
                    {
                        "data": "ch"
                        , 'name': 'channel'
                        , "render": function ( data, type, row, meta ) {
                            return data;
                        }
                    }
                    , {
                        "data": "dp"
                        , 'name': 'date_purchased'
                    }
                    , {
                        "data": "oId"
                        , 'name': 'order_id'
                    }
                    , {
                        "data": "sn"
                        , 'name': 'shipping_name'
                    }
                    , {
                        "data": "pr"
                        , 'name': 'products'
                        , "render": function ( data, type, row, meta ) {
                            return data;
                        }
                    }
                    , {
                        "data": "st"
                        , 'name': 'order_status'
                        , "render": function ( data, type, row, meta ) {
                            return data;
                        }
                    }
                    , {
                        "data": "sch"
                        , 'name': 'email_scheduled'
                        , "render": function ( data, type, row, meta ) {
                            return data;
                        }
                    }
                ]
                , "colReorder": true
            });
    

    Thank you


    0 0

    How could I insert or add a record to a joined file in DataTable Editor.

    As an example, I have 2 files Payroll and Stock Contribution file.

    The Payroll file would be used as the main driver file, it contains all employees.

    The Stock Contribution file contains records only if an employee has made a dollar amount contribution. (joined file)

    The front-end DataTable would contain data from both files.

    If the employee does not have a record in Stock Contribution file the column for dollar amount would be 0.00 (this column would be available for inline editing).
    If dollar amount is entered, I would need to insert the record into the Stock Contribution file.

    If the employee does have a record in Stock Contribution file and the column for dollar amount was changed, I would need to update the dollar amount field in the Stock Contribution file.

    I would use an Ajax call from the front-end script to call a server-side script (SSP) which would perform this function.

    Are there any examples of this architecture I can refer to?


    0 0
  • 11/14/18--01:27: DataTables - Symfony 4
  • Hi
    I'm using datatables together with Symfony 4 and this works great.
    I was now wondering, as I fill my table with data from my MySQL DB, if I could limit the display to as example 50 entries but when I use the search he's going to look in all the data?
    As I work on a project where there are very fast thousands of entrires I'm afraid that everything would get very slow for that.
    Or does anyone use datatables with that many informations in it and can tell me about the speed?
    Many thanks already :)


    0 0

    Hello,

    I have an editor that's displayed on the page using the onPageDisplay function. Some of the fields are select2 objects using ajax as data source.
    When the form is shown, I see 2 initialValue requests for each of the select2 fields ("http://localhost:53686/Registraties/getOptions/TYB?initialValue=true&value=%22%22"). Is this to be expected?
    (Sorry, but I can't make this accessible online to debug...)

    The form is shown as follows:

            editor
                .buttons({
                    label: "Save",
                    fn: function () { this.submit(); }
                })
                .create(1, true, {
                    focus: null
                });
    
    

    Example of a select2-field definition:

                    {
                        "label": "type behandeling",
                        "name": "TYB",
                        "type": "select2",
                        "opts": {
                            placeholder: '...',
                            ajax: {
                                dataType: "json",
                                url: '/Registraties/getOptions/TYB',
                                data: function (params) {
                                    return {
                                        productid: ProductID
                                    };
                                },
                                processResults: function (data) {
                                    return {
                                        results: data
                                    };
                                },
                            }
                        }
    
                    }
    

    0 0

    Hi Allan,

    I need to provide a reset button for search field. But As you mentioned here in the discussion
    https://datatables.net//forums/discussion/comment/90418/#Comment_90418 ,
    Bootstrap's styling will remove the clear icon from the search input. This is part of Bootstrap.

    Is there any way to override style for Search field only???
    cause, other than Datatables, full web page is built with bootstrap styling.
    If bootstrap library is removed, reset button appears and works fine, but whole page looks VERY Ugly. Help me out.


    0 0
  • 11/13/18--03:00: Date range filters
  • Hi there,

    I have the users table with the registered date.

    I need to create date range filters based on the registered date. So filters are gonna be like From: To:. Any idea how can I easily achieve it? Also, I need to use datepicker from jQuery UI (1.10.3).

    Thanks,
    Marcin


    0 0

    Hi, When i click on checkbox i don't want the values of hidden columns. Hidden column values should not get selected. How to do??
    Ex: when a user click on a checkbox the entire row is getting selected irrespective of hidden columns. Hidden column values should not get selected when i click on the checkbox.

    unique(onclick)  gross
    

    Account Campaign click cost(hidden) impressions cpm(hidden)
    1 Goutham 2 4 10 1 [ ]--> checkbox

    2 Gurudhat 4 8 20 2 [check]--> checkbox

    when i click on checkbox in the second row cost and cpm should not get selected as those two are hidden because im using cost and cpm in gross.

      unique  gross(onclick)
    

    Account Campaign(hidden) click(hidden) cost impressions(hidden) cpm
    1 Goutham 2 4 10 1

    2 Gurudhat 4 8 20 2

    Many thanks in advance.
    https://jsbin.com/gidafejiku/edit?html,js,output

    Regards,
    Goutham


    0 0

    Hello,
    Using Field with a column, which is part of a compound primary key, I need to use an alias, e.g.:
    Field::inst( 'a', 'b.c' )
    Then, on client side I have to use

    fields: [
      {
        data: 'b.c',
        name: 'a'
      }
    ]
    

    ( Using just name: 'b.c' I get an error: "Primary key element is not available in data set." submitting the form)

    Adding the Field->options(), the options in the server response JSON are included as
    options: {b.c: [{label: ..., value: ...}, {label: ..., value: ...},…]} (no dotted object notation, 'b.c' is the attribute name...)

    Unfortunately, the client side is awaiting the options according to name, i.e. as
    options: {a: ...}

    So, opening the editor form, the select is empty...

    Any idea?


    0 0

    Hi,

    Please refer to this website

    http://tncrm.synology.me/emservices/tenders/

    After I turn on the sorting feature, some rows disappear. If the sorting feature is off, all rows will appear without any problem.

    Can someone please advisde me where did it goes wrong?

    <table id="tnTable1" class="tnTable footable" style="width:100%">
                    <thead>
                        <tr>
                        <th style='width:10%;'>Advertisement Date</th>
                        <th style='width:10%;'>Closing Date</th>
                        <th style='width:30%;'>Client</th>
                        <th style='width:40%;'>Project Title</th>
                        <th style='width:10%;'>Eligibility & Financial Grades</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                            if ( $t_query->have_posts() ) {
                                    // The Loop
                                while ( $t_query->have_posts() ) {
                                    echo '<tr>';
                                    $t_query->the_post();
                                    echo '<td>' . get_field('advetisement_date') . '</td>';
                                    echo '<td>' . get_field('closing_date') . '</td>';
                                    echo '<td>' . get_field('clients') . '</td>';
                                    echo '<td>' . '<a target="_blank" href="'. get_field('tender_attachment').'">' . get_the_title() .'</a>'. '</td>';
                                    echo '<td>' . get_field('ef_grades') . '</td>';
                                    echo '</tr>';
                                }
                                
                            }
                            
                            else {
                                echo "no posts found";
                            }
    
                            wp_reset_postdata();
    
                        ?>
                    </tbody>
                    </table>
    
    jQuery(document).ready( function () {
    
                    jQuery('#tnTable1').DataTable( {
                        "paging":   false,
                        "ordering": true,
                        "info":     false
                    } );
    
                    jQuery('#tnTable2').DataTable( {
                        "paging":   true,
                        "ordering": false,
                        "info":     false
                    } );
    
            } );
    
    

    0 0
  • 11/12/18--18:14: Elipsis on my button
  • hello could anyone solved or at least let me know where is my fault?

    im using AdminLTE Version 2.4.0
    with bootstrap 3.3.7 installed
    and a datatables.


    0 0

    I want to sort a specific column of date format 'dd-MMM-YYYY' in a datatable. Please guide me


    0 0

    I have small conflict to resolve.

    With some initial elements, dropdown list (the on that displays items per page) is shown correctly.

    But when I start adding buttonns for group visibility - then the dropdown list disappears, and buttons are displayed instead.

    Buttons work correctly, searching works too. Just the dropdown list is gone. What I am missing?


    0 0

    Hi,
    My table column number will be different from case to case (depending on the month amount per case). And I am not sure how to include those months data with data tables. So I created a table and populated it from the model.

    table id="MyTable"class="display row-border" cellspacing="0" width="100%">
                            <thead>
                        <tr>
                            <th>Name</th>
                            <th>Gender</th>
                            @foreach (var M in Model.MonthsCounter)
                            {
                              <th>@M.Month-@M.Year</th>   
                            }
                        </tr>
                    </thead>
                            <tbody>
                                @foreach (var item in Model.Data)
                                {
                                    <tr>
                                        <td>@item.Name</td>
                                        <td>@item.Gender</td>
                                        @foreach (var record in item.values)
                                        {
                                            <td>@record.Value</td>
                                        }
                                    </tr>
                                }
                            </tbody>
                        </table>
    

    I was wondering if its possible to add columns data from a loop... somethig in the idea of this :smile:

     { "data": "Name", "autoWidth": true, "visible": false },
     { "data": "Gender", "autoWidth": true, "visible": false },
    // someway to loop over data
      foreach (var item in data)
    {
    
    {"data": item,"autoWidth": true, "visible": false }
    
    }
    

    I understand its possible with "Editor" by using .Add, but for few more weeks i have to postpone purchesing Editor, so i was wandering if it can be done with datatables.

    BR,


    0 0
  • 11/14/18--03:22: Server-side checkbox filter
  • Hello, this is my table with 2 checkboxes: live.datatables.net/xasihece/1/edit

    I'm trying to filter data in my table with these two checkboxes (will be more checkboxes and date-picker in the future). I'm using the php server_processing php and ssp.class.php. I found some comments about custom filtering in the ssp.class.php file, but there is no example how to do it and there is no example also in the DataTables forum or internet.

    I know that I need to modify the WHERE conditoin in the ssp.class.php when checkbox is selected, but I'm completely lost how to do it. Thank you in advance.


    0 0

    Hi guys

    Please help. I just add additional export button in datatables script for export to word problem is it has color blue? Do i miss something. thanks


    0 0

    We experience header misalignments when using datatables+scroller with Edge and IE. They occur if a cell has text wrapping to multiple rows. With the following patch to jquery.dataTables.js the problem vanishes. It is possible to include this into upstream?


    0 0

    Hi,
    I have a simple datatables setup in my website, and for the general search field I want to prioritize a specific column (in my case the name column).
    This is because when users search for something that is very common in other columns don't get a lot of responses that is not the one what their searching for.

    Datatables have some in-built function to do this? Or I need to do this on my own? (seriously, I'm trying to figure out how to do this but nothing is coming in my mind).

    Hope someone can help me,
    Thank you.


    0 0

    Hi,
    I started to work with datatables but now I have a problem with the versions of jquery, because only v.1.9.1 worked. When I used v3.1.1 no data for table is available in my datatable and all functions like search or sort columns are not working, too. Here below you can see my .js. I create the json with an ObjectMapper of Java with a HashMap of a String and a List of Strings as input. The jquery.dataTables.min.js is version 1.10.4.

    function onUpdate(json) {

    // Structure of json table
    // {
    // goSlimNodes: {
    //  Number:  [String],
    //  Number:  [String],
    //  }
    //}
    
    
    var data = JSON.parse(json);
    
    console.log(data);
    $("table").contents().remove();
    
    Object.keys(data).forEach(function (key) {
        console.log(key);
    
        var goterms = data[key];
            var tr = '<tr>';
            tr += '<td>' + key + '</td>';
            tr += '<td>' + goterms.length + '</td>';
            tr += '</tr>';
            $('#table').append(tr);
    
    });
    
    var columns = [ {"title":"GoSlimNode"} ,{"title": "Counter"} ];
    
    $(document).ready(function() {
        $('#table').dataTable({
            "pagingType": "full_numbers",
            "data" : data,
            "paging":   true,
            "ordering": true,
    
            "order": [[ 1, "desc" ]],
            "search": {
                "search": "",
                "smart": true,
                "regex": true
            },
            "columns": columns,
            "columnDefs": [
                {"sortable": true, "targets": [0], sWidth: "25%", bSearchable: true, bSortable: true },
    
            ],
            "sorting": [[1, 'asc']],
        });
    });
    

    }

       ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(goSlimNodeList);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    

    Could someone help me?


    0 0

    Hello,
    a simple table with 5 columns

    Checkbox | Number | Number | Filename | a href

    eg. put in the columns numbers from 780 to 900

    if you search for 789 and 890 the search fails and nothing happens.

    So, there could be something wrong with the search logic (consecutive numbers? 123... 3456... 567... ? )
    Please, could you test and fix it?

    It happens on the bootstrap 4 version, downloaded from the wizard.

    Here's my code now

    var table = $('#mytable').DataTable( {
    pageLength : 5,
    lengthMenu: [[5, 10, 20, 25, 50, -1], [5, 10, 20, 25, 50, "Alles"]],
    "language": {
    "url": "assets/DataTables/German.json"
    },
    columnDefs: [
    { targets: [0, 4], "searchable": false},
    { targets: [0, 4], "orderable": false},
    { "type": "num", targets: [1, 2, 3] }
    ]
    } )


older | 1 | .... | 2249 | 2250 | (Page 2251) | 2252 | 2253 | .... | 2326 | newer