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

Requested unknown parameter error after saving new record

$
0
0

I am getting an error after clicking the create button on a Editor form to create a new record. However, the datatable populates correctly and editing an existing row works fine. The Editor form has both my selects populated correctly and selects the correct values on edit. I am using AJAX to get a set of customers with options appended for customer types. The error I am getting is:
DataTables warning: table id=tblcustomers - Requested unknown parameter 'custtype' for row 3, column 2. For more information about this error, please see http://datatables.net/tn/4

I think I am using latest version of DataTables and Editor. From datatables.min.js:
Included libraries: JSZip 2.5.0, pdfmake 0.1.18, DataTables 1.10.13, AutoFill 2.1.3, Buttons 1.2.4, Column visibility 1.2.4, Flash export 1.2.4, HTML5 export 1.2.4, Print view 1.2.4, ColReorder 1.3.2, Editor 1.6.1, FixedColumns 3.2.2, FixedHeader 3.1.2, KeyTable 2.2.0, Responsive 2.1.0, RowReorder 1.2.0, Scroller 1.4.2, Select 1.2.0

HTML/JAVASCRIPT

<!doctype html>
<html lang="us">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>BlueFlame Process Management - Customers</title>
        <link href="css/jquery-ui.css" rel="stylesheet">
        <link href="css/BlueFlame.css" rel="stylesheet">
        <link href="css/datatables.min.css" rel="stylesheet">

        <script src="js/jquery.js"></script>
        <script src="js/jquery-ui.js"></script>
        <script src="js/datatables.min.js"></script>


        <script>
            var editor_customer; // global editor object

            $(document).ready(function() {
            editor_customer = new $.fn.dataTable.Editor( {
                ajax: "cgi-bin/Customer.py",
                // ajax: "cgi-bin/params.py",
                table: "#tblcustomers",
                idSrc:  'id',
                fields: [ {
                            label: "Id:",
                            name: "id",
                            type: "readonly",
                        }, {
                            label: "Name:",
                            name: "name"
                         }, {
                            label: "Customer Type:",
                            name: "custtypeid",
                            type:  "select"
                         }, {
                            label: "Priority:",
                            name: "priority",
                            type: "select",
                            options: [
                                { label: "No",   value: "N" },
                                { label: "Yes",  value: "Y" }
                            ]
                        }
                    ]
                } );

                $('#tblcustomers').DataTable( {
                    dom: "Bfrtip",
                    ajax: {
                        url: 'cgi-bin/Customer.py?action=search&status=All',
                        dataSrc: 'Customers'
                    },
                    columns: [
                        { data: 'id' },
                        { data: 'name' },
                        { data: 'custtype' },
                        { data: 'priority' }
                    ],
                    select: true,
                    buttons: [
                        { extend: "create", editor: editor_customer },
                        { extend: "edit",   editor: editor_customer },
                        { extend: "remove", editor: editor_customer }
                    ]
                } );
            } );


        </script>
    </head>
    <body>

        <table id="tblcustomers" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Type</th>
                    <th>Priority</th>
                </tr>
            </thead>

        </table>

    </body>
</html>

AJAX from Server

{
    "Customers": [{
        "priority": "Y",
        "name": "ALAN  ",
        "custtype": "Standard Fabricator",
        "custtypeid": "2",
        "id": "2"
    }, {
        "priority": "N",
        "name": "Eric",
        "custtype": "Retail",
        "custtypeid": "1",
        "id": "8"
    }, {
        "priority": "N",
        "name": "MOVING PROS",
        "custtype": "Standard Fabricator",
        "custtypeid": "2",
        "id": "1"
    }, {
        "priority": "N",
        "name": "test",
        "custtype": "Retail",
        "custtypeid": "1",
        "id": "9"
    }],
    "options": {
        "custtypeid": [{
            "status": "Active",
            "label": "Retail",
            "value": "1"
        }, {
            "status": "Active",
            "label": "Standard Fabricator",
            "value": "2"
        }, {
            "status": "Active",
            "label": "Special",
            "value": "3"
        }]
    }
}

Wrap only a single column in a specific table

$
0
0

Hi,

I'm using datatables for data grids. I have the global css set as white-space: nowrap; and it works fine.
However, only for a specific table there is only one column that I need to wrap text based on white spaces.
I tried to set inline css on the needed td but it doesn;t work (<td style="word-wrap: break-word;">${row.commentDetails}</td>)
Please take into account that I initially create the table without any rows, and based on the user selection of the parent table, I fill the specified table wit the data using datatables js APIs such as
notesTable.row.add( ['', SYSROWID, USERNAME, APPLICATIONNO, CATNO, WFUID, COMMENTDETAILS, PROCESSNAME, COMMENTDATEASINT, COMMENTDATE ] ).draw();

Please advise and please give detailed solution.

Thanks
Ridwan

Add 2nd line to row - similar to .child()

$
0
0

Hello,

is it possible to add a 2nd line with information to a row?

Thx for reply!

Class tag doesn't seem to be doing anything

$
0
0

Hello, jscript noob here.

I've been trying to use Datatables and I've run across an issue where changing the class of the table doesn't seem to do anything.

I have an aspx page calling a method that gets the data from SQL, data shows correctly, references to jquery and datatables js look fine, css seem to be used but I don't get the hover and one in everyline with a different background colour.

Any idea of what it could be?

Worth noting that I'm on IE9 and can't seem to be able to use firefox/chrome so I can't check if it's because of that.

Thanks in advance for any clue.

Trying to create a yadcf filter for a column with images

$
0
0

I need to create a filter on a tipical columns created with images: each field is an image with this format:

<img src='http://lab.onclud.com/psm/blackcircle.png' class='notasg'>

I've created a fiddle example here.

An explication:
* there are only 2 diferents status: [assigned/not assigned] although there are 4 diferents images (black, red, yellow and green).
* Only black image correspond to not assigned status. The others three ones (red, yellow and green) correspond to assigned status.
* As you could see, I've tried to differentiate those status by class HTML tag in img elements (notasg/asgn).

Thanks in advance.

Not getting Button options?

$
0
0

Hi,

i am new to dataTable, using the below code i am generating grid
javascript code:
$(document).ready(function () {
$('#example').dataTable({
"sDom": 'T<"clear">lfrtip',
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "print",
"bShowAll": false
}
]
}
});
});

here, i am not getting any button options, can you please tell me why it is not getting?
Thanks.

Header is not moving along with vertical scroll

$
0
0

I have added https://cdn.datatables.net/v/dt/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.13/b-1.2.4/b-colvis-1.2.4/b-flash-1.2.4/b-html5-1.2.4/b-print-1.2.4/cr-1.3.2/sc-1.4.2/se-1.2.0/datatables.min.js
in my html page,for scroller feature if i add more columns it overlaps other content of window page or just table body moves without moving header.
As mentioned in other posts i have not included FixedHeader in html/js/css files
I am not able to add test page as I am receiving data from web service,so here is my code...
`<html>
<head>

<script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/datatable/select2.full.js"></script>
    <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/datatable/jquery.dataTables.yadcf.js"></script>
    <link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/js/datatable/datatables.min.css" />

<link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/js/datatable/select2.min.css" />
    <h2 style="color:#2196F3;">Ticket Data</h2>

```

</head>
<body>
 <table id="ex1" class="display cell-border" cellspacing="0" width="100%">
</table>
<script>
$(document).ready(function() {
     var realPath =$(&quot;#root&quot;)&#46;val();
        var webServicePathm = realPath+&quot;/mt/saasreporting/getopenticketsdata?&quot;;
        //var project = projectname.innerText;
        var parmUrl = &quot;project=test project&quot;;
        var webCallUrl = webServicePathm+parmUrl;

      var Table= $(&#39;#ex1&#39;).DataTable( {


          rowReorder: true,
            colReorder: true,

 &quot;ajax&quot;: {
   &quot;url&quot;:webCallUrl,
   &quot;dataSrc&quot;: function ( json ) {
       for ( var i=0, ien=json.length ; i&lt;ien ; i++ ) {
           json[i][0] = &#39;&lt;a href=&quot;/message/&#39;+json[i][0]+&#39;&gt;View message&lt;/a&gt;&#39;;
         }
         return json;
       }
 },
 &quot;columns&quot;: [
             { &quot;data&quot;: &quot;client&quot;, &quot;name&quot;: &quot;client&quot;, &quot;title&quot;: &quot;client&quot; },
             { &quot;data&quot;: &quot;project&quot;, &quot;name&quot;: &quot;project&quot;, &quot;title&quot;: &quot;project&quot; },
             { &quot;data&quot;: &quot;raisedOn&quot;, &quot;name&quot;: &quot;raisedOn&quot;, &quot;title&quot;: &quot;raisedOn&quot; },
             { &quot;data&quot;: &quot;ticketId&quot;, &quot;name&quot;: &quot;ticketId&quot;, &quot;title&quot;: &quot;ticketId&quot; },
             { &quot;data&quot;: &quot;assignedTo&quot;, &quot;name&quot;: &quot;assignedTo&quot;, &quot;title&quot;: &quot;assignedTo&quot; },
             { &quot;data&quot;: &quot;priority&quot;, &quot;name&quot;: &quot;priority&quot;, &quot;title&quot;: &quot;priority&quot; }



         ],
         &quot;pagingType&quot;:&quot;full_numbers&quot;,
         select: true,

&quot;sDom&quot;: &#39;B&lt;&quot;clear&quot;&gt;Wfrtip&#39;,
lengthMenu: [
[ 10, 12, 50, -1 ],
[ &#39;10 rows&#39;, &#39;12 rows&#39;, &#39;50 rows&#39;, &#39;Show all&#39; ],
],

&quot;buttons&quot;: [
{
    className: &#39;b2&#39;,
extend:&#39;pageLength&#39;,
autoClose: true,
/* text: &#39;&lt;i class=&quot;fa fa-list-ol-3x&quot; aria-hidden=&quot;true&quot; style=&quot;color:#81ad30&quot;&gt;&lt;/i&gt;&#39;, */
titleAttr: &#39;no.of rows&#39;

},
{
    className: &#39;b2&#39;,
extend: &#39;colvis&#39;,
  autoClose: true,
 /*   text: &#39;&lt;i class=&quot;fa fa-columns-3x&quot; aria-hidden=&quot;true&quot; style=&quot;color:#81ad30&quot;&gt;&lt;/i&gt;&#39;, */
  titleAttr: &#39;Column Visibility&#39;,
  exportOptions: {
      columns: &#39;:visible&#39;,
  }
}
],

ScrollY:        true,
deferRender:    true,
scrollCollapse: true,
ScrollX: 300


        });

      new $.fn.dataTable.Buttons( Table, {
          buttons: [
              {
                  className: &#39;b1&#39;,
                                                extend:    &#39;copyHtml5&#39;,
                                                            /* text:      &#39;&lt;i class=&quot;fa fa-files-o&quot; style=&quot;color:green&quot;&gt;&lt;/i&gt;&#39;, */
                                   titleAttr: &#39;Copy&#39;,
                                            exportOptions: {
                                                    modifier: {
                                                        page: &#39;current&#39;
                                                    }
                                          }

                               },{
                                 className: &#39;b1&#39;,
                                            extend:    &#39;excelHtml5&#39;,
                                                           /*  text:      &#39;&lt;i class=&quot;fa fa-file-excel-o&quot; style=&quot;color:green&quot;&gt;&lt;/i&gt;&#39;, */
                                   titleAttr: &#39;Excel&#39;,
                                            exportOptions: {
                                                columns: &#39;:visible&#39;,
                                                modifier: {
                                                        page: &#39;current&#39;
                                                              }
                                            }
                               },{
                                 className: &#39;b1&#39;,
                                            extend:    &#39;csvHtml5&#39;,
                                                            /* text:      &#39;&lt;i class=&quot;fa fa-file-word-o&quot; style=&quot;color:green&quot;&gt;&lt;/i&gt;&#39;, */
                                titleAttr: &#39;CSV&#39;,
                                            exportOptions: {
                                            columns: &#39;:visible&#39;,
                                                modifier: {
                                                        page: &#39;current&#39;
                                                          }
                                            }

                               },
                {
                                 className: &#39;b1&#39;,
                                 extend:    &#39;pdfHtml5&#39;,
                                 message:&#39;Tickets Status&#39;,
                                           /*  text:      &#39;&lt;i class=&quot;fa fa-file-pdf-o&quot; style=&quot;color:red&quot;&gt;&lt;/i&gt;&#39;, */
                                   titleAttr: &#39;PDF&#39;,
                                   footer: true,
                                            exportOptions: {
                                                columns: &#39;:visible&#39;,

                                                 modifier: {
                                                                    page: &#39;current&#39;
                                   }
                          }
                               },
                 {
                        className: &#39;b1&#39;,
                        extend: &#39;print&#39;,
                        /* text: &#39;&lt;i class=&quot;fa fa-print&quot; aria-hidden=&quot;true&quot; style=&quot;color:blue&quot;&gt;&lt;/i&gt;&#39;, */
                        titleAttr: &#39;Print&#39;,
                        footer: true,
                        autoPrint: true,
                        exportOptions: {
                        columns: &#39;:visible&#39;,
                        modifier: {
                        page: &#39;current&#39;
                        }
                    }
                }
          ]
      } );

      Table.buttons( 1, null ).container().appendTo(
              Table.table().container()
);

      yadcf.init(Table, [
                            {
                column_number : 0,
                filter_type: "multi_select",
                select_type: 'select2',
                column_data_type: "text",
                html_data_type: "text",
                filter_default_label: "clients"
                            },
                            {
                column_number : 1,
                filter_type: "multi_select",
                select_type: 'select2',
                column_data_type: "text",
                html_data_type: "text",
                filter_default_label: "projects"
                            },
                            {
                column_number : 2,
                filter_type: "multi_select",
                select_type: 'select2',
                column_data_type: "text",
                html_data_type: "text",
                filter_default_label: "raisedOn"
                            },
                            {
                column_number : 3,
                filter_type: "multi_select",
                select_type: 'select2',
                column_data_Type: "text",
                html_data_type: "text",
                filter_default_label: "ticketId"
                            },
                            {
                column_number : 4,
                filter_type: "multi_select",
                select_type: 'select2',
                column_data_type: "text",
                html_data_type: "text",
                filter_default_label: "assignedTo"
                            } ,
                            {
                                column_number : 5,
                                filter_type: "multi_select",
                                select_type: 'select2',
                                column_data_type: "text",
                                html_data_type: "text",
                                filter_default_label: "tag"

                            }

                   ]);

      $('#search').on( 'click', function () {
          Table.search( this.value ).draw();
        } );
    });

    </script>

</body>
</html>

`

Default Sort functionalty not working correctly when on-demand loading of data is implemented.

$
0
0

After implementing on-demand loading of data the default column-sort functionality is working inconsistently.

In some cases the data-table gets sorted in wrong order and in some cases the sort-image(arrows) is displayed incorrectly. Although in most cases the sorting is done correctly. Hence there's consistency issues.

Kindly see the attachments.

e.g) First image shows correct sort order for 'Description' column. But sometimes the sorting for same column goes wrong as seen in second attachement.

I have set the descending order as default for the 'Request #' column at the code-level. Here's the code for it: (This code works correctly. Whenever the page loads for first time the Request# column gets sorted in descending order)

var bIsLoad = false;

var searchFilters = function () {
 var search = {

 SortColumn: bIsLoad ? settings.aoColumns[settings.aLastSort[0].col].data : "RequestNo",
 SortDirection: bIsLoad ? settings.aLastSort[0].dir : "desc"
  };

 bIsLoad = true;

return JSON.stringify(search);
}

Here's my sample datatable JS code :

 "dom": '<"top"lB>tr<"bottom"ip>',
 "lengthMenu": [[10, 25, 50, 100, 500], [10, 25, 50, 100, 500]],
 "pageLength": 25,
 "pagingType": "full_numbers",
 "ordering": true,
 "order": [[0, "desc"]],
 "scrollX": true,   "filter": true,
 "responsive": true,
 "serverSide": true,
 "info": true,    "processing": true,
 "stateSave": true,

 "ajax":
             {
                 "url": Helper.baseUrl() + "Home/LoadData",
                 "type": "POST",
                 "datatype": "json",
                 "data": function (d) {
                     d.searchParams = searchFilters();
                 },
             },

Here the debug link : http://debug.datatables.net/idoquj

Can you tell me why the data get's sorted incorrectly? How can I solve this issue?
All I want is to make any column to sort accordingly consistently. Currently i


Feature Request: Select Type - Additional Attributes

$
0
0

I've tried looking for a way to do this, but have come up short. What I'm looking for is a way to add additional data to my <select> -> <option> tags. Specifically the global data-* attribute.

I see in this similar post (https://www.datatables.net/forums/discussion/30713/add-an-attribute-to-an-option-of-a-select-input) you had mentioned that you weren't planning on adding it. I've been using Editor in multiple projects, and there have been many times that this would come in handy. Instead I have to perform an aJax call to get the data, which in my country just adds more wait time due to varying (bad) internet speeds. I think to be able to have the data upfront, would allow for quicker manipulation of the Editor form, and using the dependent() method (for example, if an item in select list 1 was chosen, automatically highlight the relevant item in the 2nd select list).

Thanks :smile:

Row CallBack

$
0
0

Hi All

I am new on DT, i recently installed it on Laravel 5 and i am struggling to have the jquery dialog opened when i click into a DT row.
So what i am trying to accomplish is the following:
1. I will bring my records using DT from my Database.
2. Once my DT is created i then call a fnRowCallback to have that row, but the data is loaded dynamical from a different URL. (see code below). when i click on the row, it actualy opens the dialog, but the dialog only contains the data of the row instead of the dat that was returned from the url i pass on the fnRowCallback.

// The Callback
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
var id = aData.id;
var url = "<?= URL::to('/');?>" +"/user/" +id +"/edit";
var ref = url;
$(nRow).attr("title","View Detail - " +aData.name +' ' +aData.surname );
$(nRow).attr("href",ref);
$(nRow).addClass('popup-edit');
return nRow;
}

// Where i click on row

$('#users').on( 'click', '.popup-edit', function (e) {

$(this).dialog({
dheight: 500,
dwidth: 750,
modal: true,

});
});

That is driving me crazy for days now and i appreciated if someone could help me.

Thank you in advance :)

Issue with colReorder and colVis - Columns display in the wrong order

$
0
0

Hi everyone!
I'm using Datatables 1.10.12 and I have a problem. My table needs to have the ability to change colmun order and to show/hide columns. So I use colReorder and colVis. colReorder works fine.
But when I hide a column and show it again, the header displays at the right place, but the column content displays in the last column of the table. So the whole content of my table moves one columns on the left...
I have been trying to solve this for hours but I can't find the solution!
Thanks a lot for your help!
Here is my code:

$(document).ready(function() {
    var table = $('#tableau').DataTable( {
        colReorder: true,
        paging:   false,
        ordering: true,
        info:     true,
        scrollY:  '50vh',
        scrollX:    true,
        bFilter:    true,
        stateSave:  true,
        select:     true,
        dom:    "B<'clear'>lfrtip",
        buttons:    [
            {
                extend: 'colvis',
                postfixButtons: [ 'colvisRestore' ]
            }
        ],
        language: {
               select: {
                rows: {
                    _: "%d lignes s&eacute;lectionn&eacute;es",
                    0: "",
                    1: "1 ligne s&eacute;lectionn&eacute;e"
                }
            },
            url: 'datatables/french.lang'
            },

    "stateSaveCallback": function (settings, data) {
     $.ajax( {
     "url": "ajax/dbManager.php?action=save",
     "data": {"name":"etat_parc.php", "state": data} ,//you can use the id of the datatable as key if it's unique
     "dataType": "json",
     "type": "POST",
     "success": function () {}
     });
    },

    "stateLoadCallback": function (settings) {
    var o;
    $.ajax( {
        "url": "ajax/dbManager.php?action=load",
        "data":{"name":"etat_parc.php"},
        "async": false,
        "dataType": "json",
        "type": "POST",
        "success": function (json) {
            o = json;
        }
    } );
    return o;
    }
    } );

Initcomplete not working well on multiple tables

$
0
0

as i am saying on the title when i am using init of datatables more then once the each table has been initialized the select of all the tables gets the data from last table

            initComplete : function () {
                this.api().column(1).every(function(){
                    var column = this;
                    var select = $('<select class="form-control input-sm"><option value="">All</option></select>')
                        .appendTo( $('.filter_data2').empty() )
                        .on( 'change', function () {
                            var val = $.fn.dataTable.util.escapeRegex(
                                $(this).val()
                            );
                            column
                                .search( val ? '^'+val+'$' : '', true, false )
                                .draw();
                        } );

                    column.data().unique().sort().each( function ( d, j ) {
                        select.append( '<option value="'+d+'">'+d+'</option>' )
                    } );
                });

            }

Uncaught TypeError: Cannot set property 'nTf' of undefined

$
0
0

i know why ntf error coming because of lot of th/td in tfoot.I want th/td in tfoot, any other solution so i remove this error from datatables

How to sort by date and time?

$
0
0

Hi, I want to sort by date and then if the dates are the same then the times to be sorted as well. How would I do this?
Image shows the data I'm working with.
Thanks

button pdf, print

$
0
0

I have in the Datatables instead of Male and Female an Icon and if they is a member of a listed group a check icon instead of 1.
if I want to export the table via print pdf the columns are empty. Is it possible to render the field to the icons if someone click on the Buttons? The icons are fontawesome and render into the table.


Outdated example

$
0
0

This page contains an outdated example: https://editor.datatables.net/reference/api/field()

editor.field( 'first_name' ).val( 'Allan' );

// results in the same action as (the difference is in the returned values,
// not used here):
editor.field( 'first_name', 'Allan' );

Only the first line of code works in the current version of Editor.

Suggestion for Data Pipe lining

$
0
0

I have a confusion about pipe lining feature.

I have say 9 pages and i set 3 pages to cache so 3 pages are cached now when i go to page 4 again a request i sent to server that is fine as well.

But now if i click page 1 again a server call is sent my question is why this call is sent as this page was cached already ?

Combodate field type plug-in

$
0
0

While I was looking for a clean way to include a duration picker in Editor I stumbled across Combodate. It was easy to integrate, and I thought it would be good to share it with others. I couldn't quite get the markdown as in the other custom Plug-ins, but I did my best.

  • Requires: Combodate
  • Requires: Moment

This plugin replaces <input type="text"> with dropdown elements to pick day, month, year, hour, minutes and seconds.

Plug-in configuration and API

Options

This field type supports the following options, in addition to the default field-options configuration:

  • object opts: Combodate initialisation options object. Please refer to the Combodate documentation for the full range of options available.
  • object attrs: Attributes that are applied to the -tag input element used for the date picker.

Methods

This plug-in does not provide any additional methods over those available for the all fields (see field()).

Plug-in code

Includes

This plug-in depends upon external libraries. These libraries can be obtained here:

Javascript

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD
        define(['jquery', 'datatables', 'datatables-editor'], factory);
    }
    else if (typeof exports === 'object') {
        // Node / CommonJS
        module.exports = function ($, dt) {
            if (!$) { $ = require('jquery'); }
            factory($, dt || $.fn.dataTable || require('datatables'));
        };
    }
    else if (jQuery) {
        // Browser standard
        factory(jQuery, jQuery.fn.dataTable);
    }
}(function ($, DataTable) {
    'use strict';

    if (!DataTable.ext.editorFields) {
        DataTable.ext.editorFields = {};
    }

    var _fieldTypes = DataTable.Editor ?
        DataTable.Editor.fieldTypes :
        DataTable.ext.editorFields;

    _fieldTypes.combodate = {
        create: function (conf) {
            var editor = this;
            conf._input = $('<input/>')
                .attr($.extend({
                    id: conf.id,
                    type: 'text',
                }, conf.attr || {}));

            setTimeout(function () {
                conf._input.combodate($.extend(
                    {
                        //Default options go here
                    }, conf.opts));
                //uncomment next line for bootstrap styling
                //$(conf._input).next('span.combodate').find('select').css('display', 'inline');
            }, 1);
            return conf._input[0];
        },

        get: function (conf) {
            return $(conf._input).combodate('getValue')
        },

        set: function (conf, val) {
            $(conf._input).combodate('setValue', val);
        },

        enable: function (conf) {
            $(conf._input).next('span.combodate').find('select').prop('disabled', false);
            $(conf._input).prop('disabled', false);
        },

        disable: function (conf) {
            $(conf._input).next('span.combodate').find('select').prop('disabled', true);
            $(conf._input).prop('disabled', true);
        },
    };
}));

Example

new $.fn.dataTable.Editor( {
 "ajax": "php/durations.php",
 "table": "#example",
 "fields": [ {
        "label": "Description:",
        "name": "description"
    }, {
        "label": "Duration:",
        "name": "duration",
        "type": "combodate",
        "opts": {
            minuteStep: 10,
            format: 'H:mm',
            template: 'H hour mm minutes',
            firstItem: 'none',
        }
    }
 ]
} );

DataTables is converting 0 to empty

$
0
0

Thanks for this awesome plugin. I am using it throughout my website and it is working well.

One issue I am facing is that Datatables is automatically converting 0 to empty value in the table. So instead of showing 0, it shows a blank value. I tried searching for this issue but could not find any relevant answers. Please help. Thanks.

remove a selected row

$
0
0

Hello,

I'm trying to perform my table in my web interface, but I am asking help for removing a selected row from this table, I'am using this code :
$(document).ready(function() {
var table = $('#example').DataTable();

        $('#example tbody ').on( 'click', 'tr', function () {
            if ( $(this).hasClass('selected') ) {
                $(this).removeClass('selected');
            }
            else {
                table.$('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        } );

       $('#delete').click( function () {
            if (table.rows('.selected').data().length==0){
                alert( table.rows('.selected').data().length +' row(s) selected, you should select the row you want to delete!' );

            }
            alert( table.rows('.selected').data().length +' row(s) selected, are you sure you want to delete this row?' );

            table.rows('.selected').remove().draw(false);
        } );


    } );

the selection is done but the row is not deleted after clicking on the button. am i missing something?
Could every one help me please ?
Thank you so much !

Viewing all 81384 articles
Browse latest View live