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

Store array in record with editor?

$
0
0

is possibile to, functionally, do something like this in editor and PHP api? whats the better way?


how to generate Automatic column generation in dataTable? without mention in script or tag

$
0
0

how to generate Automatic column generation in dataTable? without mention in script or

<

table> tag

What create a function in a extensions?

$
0
0

Example:
apiRegister( 'select.prueba()', function () {
return this.iterator( 'table', function ( ctx ) {
DataTable.select.init( new DataTable.Api( ctx ) );
}

It is ok? and a property?

thanks

How do I fix the dollar symbol appearing at the end of amounts in exported Excel spreadsheets?

$
0
0

This is in Excel for Mac version 15.41. The cells seem to be formatted with type "Currency" but reselecting "$ Cherokee (United States)", which seems to be the default dollar symbol here, fixes the placement.

How can I sort using a column with euro currency values?

$
0
0

I have a table with currency. I want to be able to sort it. The data has the euro sign symbol. I tried this:

<html>
<head>
    <script type="text/javascript"  src="js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript"  src="js/jquery.dataTables.min.js"></script>
    <script type="text/javascript"  src="js/currency.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
 var money_table=$('#moneys').DataTable();
 });
</script>

<table id="moneys">
<thead>
        <th>id</th>
        <th>chines</th>
</thead>
<tbody>
    <tr><td>0</td> <td>1.35 &euro;</td></tr>
    <tr><td>1</td> <td>15.65 &euro;</td></tr>
    <tr>    <td>2</td> <td>8.15 &euro;</td></tr>
    <tr>    <td>3</td> <td>1.00 &euro;</td></tr>
    <tr>    <td>4</td> <td>0.3 &euro;</td></tr>
</tbody>
</table>

</body>
</html>

But does not work. Any hint?

Local search with serverSide data load - pagination

$
0
0

I have created the data table with serverside:true to load data on pagination request. But when do a search it again make call to server side, but I need it to be search locally on already fetched data.

Is it possible with data table? How the configuration should look like. Please help.

$app.global.searchDataTable = $('#searchResultTableId').DataTable( {
    processing: true,
     serverSide: true,
        ajax: {url: "./api/search/pagination/documents", type: "POST", data:searchCriteria},
        ordering: true,
        //fixedHeader: true,
        scroller: true,
        scrollY: ($(window).height() - 435) + 'px',
        scrollX: true,
        scrollCollapse: true,
        initComplete: function(settings, json) {
            $('.dataTables_scrollBody thead tr').css({visibility:'collapse'});
        },
        fixedColumns:   {
            leftColumns: 3
        }
    } );

Error when attempting to sort table columns

$
0
0

This error occurs on any column that the user attempts to sort.

Error is:
jquery.dataTables.js:6129 Uncaught TypeError: Cannot create property 'length' on number '2'
at _fnSortListener (jquery.dataTables.js:6129)

Oddly in _fnSortListener the sorting variable is set to 2, but then later the code is attempting to set sorting.length = 0 which is where it fails understandably.

Debug:
https://debug.datatables.net/ojigow

Thanks,
Tim

The one polish font makes problem, why?

$
0
0

We have noticed that EditTable does not support our Polish fonts, the Ć font in particular, you can create Ć using the right Alt + C on polish keyboard. Our other fonts (ś,ń,ó,ł,ż,ź,ę,ą) work correctly. What may be the reason? You can find this problem in your example too. https://editor.datatables.net/examples/extensions/keyTable.html
Any suggestions?


How to fill out datatables with stored data json variable

$
0
0

I have one ajax query that store in variable 'msg' the data of one query in a table of database.
$.ajax({
type: 'POST',
dataType: 'html',
url: page,

    data: {idstatus: opRadio},
    success: function (msg) {
        msg = $.parseJSON(msg);

        //   $('#dataTables-example').html(msg);
    }
});

I need to fill out the table(using plugin DataTables) in front-end with data this variable, How to do this?

JQueryUI Autocomplete not autocompleting

$
0
0

Hi

I wonder if you could help me get Autocomplete to work. I have set up a basic test but still am struggling and would probably benefit from a basic example.

I am using JQueryUI/BS4/DataTables and have several different tables on a single page, 2 with editors. I want to use AutoComplete for the 'diagnosis' field. The relevant code is:

var diagnosisEditor = new $.fn.dataTable.Editor( {
        ajax: {
            url: 'common/ajax/diagnoses.php?id={id}',
            type: 'POST'
        },
        table: '#diagnoses',
        fields: [
            {
                "label": "patient_id:",
                "name": "diagnoses.patient_id",
                "type": "hidden",
                "def": "{id}"
            },
            {
                "label": "Date:",
                "name": "diagnoses.diagnosis_date",
                "type": "datetime",
                "format": "DD-MM-YYYY"
            },
            {
                "label": "Diagnosis:",
                "name": "diagnosis_list.diagnosis",
                "type": "autoComplete",
                "opts": {
                    "source": [
                        "john", "fred", "james", "malcolm", "dave", "alex", "ruby"
                    ]
                }

            },
            {
                "label": "Notes:",
                "name": "diagnoses.notes",
                "type": "text"
            }
        ]
    } );

The field appears, but AutoComplete does not seem to work. What am I doing wrong?!

Thanks in advance
Ronnie

Adding custom message that is updated as user fills out a form

$
0
0

My data include admission date and discharge date allowing the calculation of LOS.

The LOS should be the max allowed for data entry of a third field. As the user enters admission and discharge date, I would like to update (without going back to the server) the message for the third field "Please enter a number between 1 and LOS."

It seems that this can be accomplished using the API method fields().message, but I am unable to get this to work. I tried to define the message as a function as in:
message: function(data,type,row){var test=data().pluck('ddate'); return test;}
but that just shows the text of the function as the message.

I also don't understand from the documentation how to get text editor to listen to an edit event on the admission and discharge date fields. I usually can work well from examples, but there are no examples that show the syntax for generating custom dynamic field messages, all I have found is at https://editor.datatables.net/reference/option/fields.message.

Thank you for kind feedback.

Problemas con traer un dato tipo foto desde un API

$
0
0

Tengo un api que me devuelve data en la cual lleno en el detatables, en estos precisos momentos tengo problemas con jalar una data que me trae foto de un modelo.

A continuacion dejo el api:

API:
 for anuncio in anuncios:
                data = {}
                data['id'] = anuncio['id'],
                data['manifestado'] = anuncio['numero_de_manifiesto'],
                data['nave'] = anuncio['nave__nombre'],
                data['tipo_nave'] = anuncio['tipo_nave__descripcion'],
                data['nombre_linea'] = anuncio['linea_naviera__nombre'],
                data['nro_viaje'] = anuncio['nro_viaje'],
                data['agente_maritimo'] = anuncio['agente_maritimo__nombre'],
                data['eslora'] = anuncio['nave__eslora'],
                data['eta'] = anuncio['eta'],
                data['etb'] = anuncio['etb'],
                data['etc'] = anuncio['etc'],
                data['etd'] = anuncio['etd'],
                data['carga'] = anuncio['carga'].upper()
                data['proyecto_articulo'] = anuncio['proyecto_articulo__nombre']
                # data['amarradero'] = anuncio['amarradero__nombre']
                data['reporte_servicio_url'] = reverse('reporte_servicio', kwargs={"pk": anuncio['id']})
                data['atraque_url'] = reverse('acta_maniobra_imprimir', kwargs={"pk": atra[anuncio['id']]}) if anuncio['id'] in atra else None
                data['desatraque_url'] = reverse('acta_maniobra_imprimir', kwargs={"pk": desa[anuncio['id']]}) if anuncio['id'] in desa else None
                data['foto'] = anuncio['tipo_nave__foto'],

                resultado.append(data)

También dejo el html donde llamo la data:

columns: [
                    {
                        data: "foto",
                    },
                    {data: "manifestado"},
                    {data: "nave"},
                    {data: "tipo_nave"},
                    {data: "nombre_linea"},
                    {data: "nro_viaje"},
                    {data: "agente_maritimo"},
                    {data: "eslora"},
                    {data: "eta"},
                    {data: "etb"},
                    {data: "etc"},
                    {data: "etd"},
                    {data: "carga"},
                    {data: "proyecto_articulo"},
                    {
                        "targets": -1,
                        "data": null,
                        "defaultContent": "<i class=\"fa fa-eye\" aria-hidden=\"true\"></i>",
                        "className": 'anuncio'
                    },
                    {
                        "targets": -1,
                        "data": null,
                        "defaultContent": "<i class=\"fa fa-eye\" aria-hidden=\"true\"></i>",
                        "className": 'atraque'
                    },
                    {
                        "targets": -1,
                        "data": null,
                        "defaultContent": "<i class=\"fa fa-eye\" aria-hidden=\"true\"></i>",
                        "className": 'desatraque'
                    }
                ],

El problema es que me trae la url y estaba intentando con el render y defaultContent...

Sería de mucha ayuda su aporte, dejo foto del resultado.
Gracias de antemano.

displaying Combobox in the DataTable header

$
0
0

is it possible?
combobox was displayed but when i click the combobox it does not work

How can I set condition for server side processing of datatable?

$
0
0

In my project,I want to set a condition so that if it evaluates to true then I want to go to the server through ajax.
e.g. I want server side processing only for pagination and filtering but for searching it should be conditioned i.e I want to search at client side,if it fails,then go to the server

Fill table B on selecting row in table A

$
0
0

HI, I have 2 datatables.
one cell on table A has a onClick to do a task. part of that task should also to go to a mysql db and get values and create table B.
Table B contains notes about things on the row in Table A. inside the function which runs with the onClick i get DataTable to make the table B
$('#notestable').DataTable({
"scrollY": "100px",
"scrollCollapse": true,
"paging": false
});
then create the table.
var table = "<?php $notequery = \"select * from notes where callID ='" + callID + "'\"; $noteresult = mysqli_query($db, $notequery); echo $notequery;?>

<?php while($notes = mysqli_fetch_assoc($noteresult)) {?><?php } ?>
PostedNotes
<?php echo $notes['posted']; ?><?php echo $notes['note']; ?>

";

And display table B in a

<

div>
document.getElementById('DisplayCallDiv').innerHTML = table;

the table gets rendered but no data is ever displayed. The query works. I can cut and paste it and run it as a sql query and it returns the 3 rows I expect to see.

As you may gather i'm pretty new at this stuff... there has to be a much easier way to do what i'm trying to achieve.
Any help most gratefully received.

Asystems


How to implement custom editor submit ,not editor.submit()

$
0
0

DataTable Editor,
As title said,
How to implement onsubmit , or click submit button event?

I am using AWS SDK (DynamoDB, API GateWay, Cognito)
I know It's better way that use ajax in editor,
but I don't know how to send ajax request by using those AWS SDK
can you give me a example?
thanks

Bug Responsive 2.2.1 bootstrap 4 in Collapse Componet

Field validation vs. Deletion

$
0
0

Hello there,

I just started using Editor , and I'm struggling with the field validation when deleting a row.

I.c.:

  • I added a field validation for a date field which is required when inserting new records

        ->validator( 'Validate::required', array(
            "message" => "Gelieve een begindatum op te geven"
        ) )
    
  • Nonetheless, my table contains certain records which are missing this field (old dirty data). When trying to remove these records through the datatables/editor, the delete fails (fieldErrors:[{name: "calendar_vrijstelling.dtm_vanaf", status: "Gelieve een begindatum op te geven"}]).

Question: Is it possible to circumvent/bypass field validation when deleting? Or is this not possible and should i start working with preSubmit validation?

Thnx alot for any advice,

Arthur

Editor How do you achieve the full choice

$
0
0

Editor How do you implement the full selection function to achieve such a requirement?

At all the items under the checkbox is selected, you can now implement the style is selected, but after all cancelled a few items, and some export copy to clipboard or when all the data, to cancel a few among them, how to implement all right

How to load nested object array in DataTable

$
0
0

I have a json file that contains information and multiple recordsets (2 in this case). I'm trying to load them in individual datatable. I would like to load DMale DFemale in each a separate DataTable. My json file look looks like:

{
"event":[
   {
      "name":"test",
      "date":"Feb 11, 2018"
   }
],
"results":[
  {
     "Cat-D-Male":[
        {
         "Rank":"1",
         "Bib":"192",
         "First Name":"Kerry",
         "Last Name":"Reve",
         "Time":"01:01:28.445",
         "Gap":"",
         "Lap 1":"00:00:13.15",
         "Lap 2":"00:11:44.58",
         "Lap 3":"00:12:09.24",
         "Lap 4":"00:12:03.94",
         "Lap 5":"00:12:31.31",
         "Lap 6":"00:12:46.20"
        }
     ],
     "Cat-D-Female":[
        {
         "Rank":"1",
         "Bib":"178",
         "First Name":"Lisa",
         "Last Name":"Sax",
         "Time":"00:58:40.708",
         "Gap":"",
         "Lap 1":"00:00:14.89",
         "Lap 2":"00:11:49.55",
         "Lap 3":"00:11:29.52",
         "Lap 4":"00:11:21.15"
        },
        {
         "Rank":"2",
         "Bib":"325",
         "First Name":"Mellisa",
         "Last Name":"Sweet",
         "Time":"00:51:12.671",
         "Gap":"-1 Lap",
         "Lap 1":"00:00:17.52",
         "Lap 2":"00:12:56.86",
         "Lap 3":"00:12:23.24",
         "Lap 4":"00:12:54.41"
        }
     ]
  }
]
}

But I'm unable to extract DMale and DFemale to create the 2 DataTable. This is what I have so far:

<script>
  $( document ).ready( function( $ ) {
    $.ajax({
      type: "POST",
      url: 't4.json',
      cache: false,
      dataType: 'json',
      success: function(response) {
        $("#ResultsDiv").empty();
        $("#eventname").append(response.event[0].name);
        $("#eventdate").append(response.event[0].date);
        $("#eventlocation").append(response.event[0].location);
        console.log("1:" + response);
        var totalMessages = Object.keys(response.results[0]).length;
        console.log("2: Count= " + totalMessages);
        $.each(response.results[0], function(key, val) {
          console.log("3a:" + key);
          console.log("3b:" + val.length);
          console.log("3c:" + JSON.stringify(val));
          initiateTable(key, val);
        });
      }
    })

    function initiateTable(tableId, source) {
      $("#ResultsDiv").append('<table id="' + tableId + '" class="table table-striped table-condensed" cellspacing="0" width="100%"></table>');
      var table = $("#" + tableId).dataTable({
        "data": source,
        "bProcessing": true,
        "bPaginate": false,
        "bLengthChange": false,
        "bFilter": true,
        "bInfo": false,
        "bAutoWidth": true,
        "columnDefs": [{
          "targets": 'no-sort',
          "orderable": false
        }]
      });
    }
});
</script>

How can I pass each dataset to create a new DataTable and load the data and append it to the others tables in my div? I'm vey new at using JSon and DataTable, this is the fist time I use it.

Viewing all 81692 articles
Browse latest View live


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