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 | .... | 2289 | 2290 | (Page 2291) | 2292 | 2293 | .... | 2326 | newer

    0 0

    I recently joined this forum, and got my first question successfully answered (yay, community!). But I never got any emails, either about creating the account in the first place or when I got replies to my question. No, there is nothing relevant in my Junk Folder. Here is a screenshot of my Notification Preferences:

    I don't know what a "wall" is, but I think the type I should have gotten is "when people comment on my discussions". I also bookmarked my discussion, but that didn't help.


    0 0

    Hi, I have a table which uses server-side processing to deal with a db that gets around 500k new rows a day. The db is updated via external scripts and the table is only built when someone views the page.
    One of the columns contains a value of either yes or no. I want to be able to display a link in that cell if it is yes. I'm already using the following for 1 column and it works well.

    "columnDefs": [ {
            "targets": 0,
            "data": null,
            "defaultContent":
      "<button class='btn btn-small '><li class='fas fa-play-circle 2x'  id='play'>Play</li></button><li class='fas fa-thumbtack'></li>"
        },
    

    i have a handler

      $('#calltable tbody').on( 'click', 'button', function () {
    

    which works for that button.
    I want to have an icon
    <li class="fas fa-thumbtack" onclick="showModal(-- row number --)"><li>
    in the row where the cell value = 'Yes'.
    So i also need to know how to identify the row number.

    any help greatly appreciated.


    0 0

    I have two buttons that I would like to filter the ajax data presented in the table with.

    The filter would show a therapists status (ACTIVE, INACTIVE). When I click the "Show active" button the table should only show the therapists with an ACTIVE status and the "Show inactive" button when clicked should only show the INACTIVE status. Since I already have all the rows loaded in the table that show both ACTIVE and INACTIVE I thought a columns().search() should be all I need but I keep getting an 'Uncaught SyntaxError: Unexpected String' pointing to $('#active').on( 'click', function () {

    var table = $('#vetted_therapists').DataTable( {
            dom: '<\"top\"Bfl>iprt<\"bottom\">p<\"clear\">',
            ajax: 'vetted_therapists-con.php',
            columns: [
                { data: 'vetted_therapists.id' },
                { data: 'vetted_therapists.specialty' },
                { data: 'vetted_therapists.first_name' },
                { data: 'vetted_therapists.last_name' },
                { data: 'vetted_therapists.address' },
                { data: 'lk_cities.city' },
                { data: 'lk_states.state' },
                { data: 'lk_zip_codes.zip_code' },
                { data: 'vetted_therapists.home_phone_number' ,
                      render: function ( data ) {
                                    var hPhone=data;
                                    if(hPhone.length > 9) {
                                hPhone='(' + hPhone.substring(0,3) + ') ' + hPhone.substring(3,6) + '-' + hPhone.substring(6,10);   
                                return hPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                        }
                 },
                { data: 'vetted_therapists.office_phone_number',
                      render: function ( data ) {
                                    var oPhone=data;
                                    if(oPhone.length > 9) {
                                oPhone='(' + oPhone.substring(0,3) + ') ' + oPhone.substring(3,6) + '-' + oPhone.substring(6,10);   
                                return oPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'vetted_therapists.office_phone_extension_number' },
                { data: 'vetted_therapists.office_phone_toll_free_number',
                      render: function ( data ) {
                                    var otfPhone=data;
                                    if(otfPhone.length > 9) {
                                otfPhone='(' + otfPhone.substring(0,3) + ') ' + otfPhone.substring(3,6) + '-' + otfPhone.substring(6,10);   
                                return otfPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'vetted_therapists.work_phone_number',
                      render: function ( data ) {
                                    var wPhone=data;
                                    if(wPhone.length > 9) {
                                wPhone='(' + wPhone.substring(0,3) + ') ' + wPhone.substring(3,6) + '-' + wPhone.substring(6,10);   
                                return wPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'vetted_therapists.work_phone_extension_number' },
                { data: 'vetted_therapists.cell_phone_number',
                      render: function ( data ) {
                                    var cPhone=data;
                                    if(cPhone.length > 9) {
                                cPhone='(' + cPhone.substring(0,3) + ') ' + cPhone.substring(3,6) + '-' + cPhone.substring(6,10);   
                                return cPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'vetted_therapists.cell_phone2_number',
                      render: function ( data ) {
                                    var c2Phone=data;
                                    if(c2Phone.length > 9) {
                                c2Phone='(' + c2Phone.substring(0,3) + ') ' + c2Phone.substring(3,6) + '-' + c2Phone.substring(6,10);   
                                return c2Phone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'vetted_therapists.fax_number',
                      render: function ( data ) {
                                    var fPhone=data;
                                    if(fPhone.length > 9) {
                                fPhone='(' + fPhone.substring(0,3) + ') ' + fPhone.substring(3,6) + '-' + fPhone.substring(6,10);   
                                return fPhone;
                                    }else{
                                       var empty='NA';
                                       return empty;
                                    }
                    }
                },
                { data: 'tbl_code.location_code' },
                { data: 'tbl_location.location' },
                { data: 'vetted_therapists.email' },
                { data: 'vetted_therapists.military' },
                { data: 'vetted_therapists.status' },
                { data: 'vetted_therapists.notes' },
                { data: 'vetted_therapists.last_revised' }
             ],
             $('#active').on( 'click', function () {
               table.columns(21).search('ACTIVE').draw();
            } );,
    

    And my html is as follows...

    <tr><th colspan=24>
            <div class=\"container\">
               <label id='active' class=\"button\"><input type='submit' class='btn btn-primary' name='active' value='Show active')></label>
               <label id='inactive' class=\"button\"><input type='submit' class='btn btn-primary' name='inactive' value='Show inactive')></label>
            </div>
            </th></tr>
                <tr>
                              <th>ID</th>
                                <th>Specialty</th>
                                <th>First Name</th>
                                <th>Last Name</th>
                                <th>Address</th>
    etc...
    

    Help me, Obi-Wan Kenobi. You're my only hope.


    0 0

    hi,i have a question about datatables,like the example Child rows,but i need the child row show up another table!The second table like the first also use ajax to load data,now i try the way like example but i can't work,when i click the row,the child row show up a while then close,i google it whole afternoon but nothing found to solve this problem,can anyone have any ideas or did this before?


    0 0
  • 12/13/18--02:14: Jquery 3x compatibility
  • Hi
    We are using DataTables 1.9.4. Is it compatible with Jquery 3.3.1


    0 0

    I find a link https://jsfiddle.net/tf70z0L5/
    In this, color is applied based on the value ( any one cell i.e., 'O' is available in the column then column is colored ).
    But I need to apply based on the column name.


    0 0

    Per the title, the CSS for the Choose File and Clear File buttons are wrong. For example:

    <button class="btn btn-default">Choose JPG...</button>

    btn-default is not a valid Bootstrap 4 style.

    I made it pretty with:

    editor.on('open', function () {
        $('.upload button').addClass('btn-outline-primary btn-sm');
        $('.clearValue button').addClass('btn-outline-danger btn-sm');
      });
    

    0 0

    I'm unable to assign more than 1 column class. While this is working correctly:
    columnDefs: [{ className: "my_second_class", targets: 1 }]

    this is not:
    columnDefs: [{ className: "my_class", targets: "_all" }, { className: "my_second_class", targets: 1 }]

    Library version is 1.10.18


    0 0

    As of now I am validating fields when I navigate from the field ( by pressing tab/enter/click ). My editor is configured as below

    formOptions : {
    inline : {
    onBlur : 'submit',

    And my validation is happening within below block.

    table.editor.on('preSubmit', function(e, o, action) { }.

    My need is, I need to validate that two fields( same row) are having related value( based on some validation logic) once I had edited both. Else I need to show error in the both the fields. Kindly give any reference or idea regarding this. Thanks in advance.


    0 0

    How to put 2 text (title) before the header?


    0 0

    Dear Allan!
    I not use paginate, and the server side load too many row when start ajax.
    Can I decrease length parameter when called php?
    in php:

       private function LoadData()
        {
    ....
            if(isset($_REQUEST["start"]) && isset($_REQUEST["length"]) && !isset($_REQUEST["action"]))
            {
                
                $len=$_REQUEST["length"];
    ....
    

    I have 100 columns and i need read only 50 row each ajax call (50*100 field is 5000 field) , but I not can set loading row column number.


    0 0

    Hi,

    We are already using DataTables in our asp.net mvc 5 web application and are considering buying Editor to support local, inline editing. We appreciate the existence of the .net libraries for server side code but are a bit confused about how the whole thing work and if it is going to fit our needs.

    More specifically, there is no database in our project. The data are provided by web services, instead. Right now, we are using a simple ajax Datatables call to fetch and show the data. Everything (the columns, the rendering etc) is defined client-side in the DataTables initialization.

    Is the Editor .net library any good to us? or is it specifically for database connection only?


    0 0

    I am trying to reload my table on the click of a button using table.ajax.reload().
    I'm getting an invalid JSON error and upon going through troubleshooting with datatables/tn1, I can see that it is returning html/text instead of JSON.
    How do I parse the data on reload?
    I've tried various ways of combining table.ajax.reload() with JSON.parse(), but none have worked.

    Thanks


    0 0

    I'm using datatable editor with inline editing. When I make an edit on a row I use "allIfChanged" to submit my entire row and update a record on my server. Before submit I do some client side field validation using your example at https://editor.datatables.net/examples/api/clientValidation.html . This works well when I'm only doing validation on the current field. However I want to validate all of the fields in the row to know if I should be able to submit or not and showing error message(s) at the fields which fail validation.

    The issue I'm encountering is as follows.

    1) I edit a cell which fires the submit event
    2) editor goes into my "presubmit" event
    3) I validate all my fields and one of the fields in a column im currently not editing on that row fails validation
    4) I add an error to that field using .error(fieldname, mymessage)
    5) I check editor.isError() and return false if any of the fields have errors
    6) at this point datatables does not leave focus on the current field and keeps the input markup in that cell. the submit never happens so the row is never updated, however none of the other errors in the other cells show up so it LOOKS like to the user nothing has happened. When in reality there are errors on the other fields.

    My assumtion is, when inspecting the html of another cell that should show the error, none of the datatable markup for the field errors is there so your editor code has no dom elements to inject the error text in. It looks like this markup only exists on the currently edited field.

    Is there a way to make the errors show up even if the field is not in the inline edit state?


    0 0

    ****I try this code but it has a error********

    Editor::->where( function ($q) {
    $q->where( 'id',$limit );
    } )


    0 0

    Hello, I have DataTable with button in row child. I have hidden content below the button and I need to display this hidden content after click on this button. I tried it on my own, but the best working version was, that the button in one row child also manages the content of all other childrows. :(

    He re is my test case https://jsfiddle.net/nnb97rh9/1604/

    Thank you


    0 0

    We have a table with ScrollX, ScrollY, FixedHeader and FixedColumn (0) and everything works fine with Chrome (Windows and Android) and with Firefox (Windows) as you can see in the following picture

    With Safari on MAC it seems the column width is calculated considering the complete string
    IT043FO111‑CSD IT027PG401‑MAR
    without taking in account it shall be splitted in two rows
    IT043FO111‑CSD
    IT027PG401‑MAR

    Please refer to the following picture

    Thanks for your support


    0 0

    Steps:
    Data-table with editor has multiple select2 in form.
    ->select2 is binded data with ajax.
    ->when datatables->create is called new form with select2 works fine , shows autocomplete retrieved through ajax and sets value to the text input when option selected from auto fill.

    Question:
    But not able to set the initial value to select2 when a particular row is selected from data-table.Noticed ajax calls in console for the select2 when edit button is clicked after row is selected.

    screenshot :

    code :

    {
                     "label": "Area",
                     "name": "Area.AreaId",
                     "type": "select2",
                     "data": "Area.AreaName",
                     "initialValue":true,
                     "opts": {
                  "templateResult": function(data) {
    
                          return data.text;
                      },
                      "templateSelection": function(data) {
                          alert(JSON.stringify(data.text));
                           return data.text;
                      },
                         "minimumInputLength": 3,
                         "placeholder": 'Area',
                         "allowClear": true,
                         //"initialValue":true,
                         ajax: {
                           url: 'Area/json',
                           delay: 250 ,
                           dataType: 'json',
                          initialValue:true,
    
                         data: function (params) {
                             var query = {
                                   value: params.term
    
                             }
    
                             // Query parameters will be ?search=[term]&type=public
                             return query;
                           },
                         processResults: function (data) {
                           return {
                               results: $.map(data, function(obj) {
                                   return { id: obj.AreaId, text: obj.AreaName };
                               })
                           };
                       }
                         }
                     }
                 }
    

    thanks


    0 0

    Hello, can anyone to tell me where is my erorr in this cod please.

    function loadTable() {

    $.ajax({
        url: "/rest/Inventory/List",
        method: "GET",
      dataType: "json",
      success: function(data, items) {
    
         var dataSet = [];
    
          for(var i = 0; i < data.items.length; i++) {
                dataSet.push([
                    data.items[i].id,
                    data.items[i].device,
                    data.items[i].type.name,
                    data.items[i].additionalInfo,
                    data.items[i].serialNumber,
                    data.items[i].person.name,
                    data.items[i].location.name
                ]);
            }
    
            $('#data-table').DataTable( {
                data: dataSet,
                columns: [
                    { title: "Id" },
                    { title: "Device" },
                    { title: "Type" },
                    { title: "Additional Info" },
                    { title: "Serial Number" },
                    { title: "Person" },
                    { title: "Location" }
                ]
            } );
    
      }
    });
    

    }


    0 0
  • 12/13/18--03:00: Large data file uploads
  • Hello everyone,

    I'm new to datatables and I have been using the 15 day trial to explore the tool's feature sets and so far, I must say I'm very impressed.
    I know image files can be uploaded while creating new row data entires - but I have a particularly important use case that I'm working on that requires large data sets (tens of thousands of rows and several tens of columns) to be uploaded at a go through CSV files at the front end by the end users.

    Can anyone advise me if datatables natively supports this feature?

    Thank you


older | 1 | .... | 2289 | 2290 | (Page 2291) | 2292 | 2293 | .... | 2326 | newer