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

Possible bug combining rowReorder and rowGroup

$
0
0

When combining rowReorder and rowGroup when dragging an element up to the stop of the table it ends up above the top row, which is pretty weird. This seems lik a bug?

Drag a row to the top of the table.
https://jsfiddle.net/6tnn7j24/1/


Populating select element from database table

$
0
0

I need to populate a select element from another (unrelated) table. This other table is just a list of valid entries for the select field. I think that I need to return an array that contains the entries that should populate the options of the field in the Editor. It seems that a function could return that array. However, I don't have a sense of how to get the contents of this other, unrelated table in the context of an Editor for the table I'm working on.

Consider that I have a 'category' field in Table A. I also have a Category table that contains the list of valid entries for the 'category' field of Table A. In the Editor for Table A, I need to offer a select element containing the contents of the 'category' table.

I can easily do this outside of DataTables/Editor, but I need to do it within the Editor.

Date Format validator doesn't work proper

$
0
0

Hi,

I used the generator and created two entries
valid from
valid until
with the German date format "dd.MM.yy".

It works fine for the online preview.

Starting the project leads to the following situation, http://prntscr.com/hvjjxp , where it is possible to store a date like 01.01.18, but not 10.01.18.

The POST request includes

data[0][gueltig_von] 01.01.18
data[0][gueltig_bis] 10.01.18

The result is

{
   "draw":null,
   "data":[

   ],
   "recordsTotal":null,
   "recordsFiltered":null,
   "error":null,
   "fieldErrors":[
      {
         "name":"gueltig_bis",
         "status":"Input not valid"
      }
   ],
   "id":null,
   "meta":{

   },
   "options":{

   },
   "files":{

   },
   "upload":{
      "id":null
   },
   "debugSql":[

   ],
   "cancelled":[

   ]
}

debugSql is empty, also I set

.Debug(true)

in the Controller.cs

The validation in the Controller.cs is

                    .Field(new Field("gueltig_von")
                            .Validator(Validation.DateFormat("dd.MM.yy"))
                            .GetFormatter(Format.DateSqlToFormat("dd.MM.yy"))
                            .SetFormatter(Format.DateFormatToSql("dd.MM.yy"))
                    )
                    .Field(new Field("gueltig_bis")
                            .Validator(Validation.DateFormat("dd.MM.yy"))
                            .GetFormatter(Format.DateSqlToFormat("dd.MM.yy"))
                            .SetFormatter(Format.DateFormatToSql("dd.MM.yy"))
                    )

The type of both dates are "date" in the MS SQL SERVER.

I suspect that there is an error in the validation for the German date format.

All the best,
Markus

Force use of datepicker?

$
0
0

Is there a way to force the user to use the datepicker? ie - disallow typing in the input box?

Use data from one datatable to create another datatable?

$
0
0

Is it possible to create a second datatable by using data from the first data table? I'm on SharePoint Online/Office 365. Using REST, I populated the first datatable with all 'pending' items. In my datatable settings, I added a column for user to 'check' other approved absence requests within the same date range as the current request.

"aoColumns": [
                {//check link
                    "render": function(data, type, row) {
                        var rowID = row.ID;
                        var rowEventDate = row.StartDateISO;
                        var rowEndDate = row.EndDateISO;
                        return  '<a href="javascript:modCheck(' + rowEventDate + "," + rowEndDate + ');">Check</a>';
                    }
                },

When user clicks the [check] link, it should populate another datatable

function modCheck(rowEventDate, rowEndDate) {

        var webAbsUrl = _spPageContextInfo.webAbsoluteUrl;
        var checkInfo = webAbsUrl + "/_api/web/Lists/getByTitle('AbsenceRequest')/Items?$filter=((StartDateISO ge datetime'" + rowEventDate.toISOString() + "') and (EndDateISO le datetime'" + rowEndDate.toISOString() + "'))&$select=Id, Absentee, RequestType, ActivityType, EventDate, EndDate, Status";

        var ajaxAllAbsences = $.ajax({
            url: checkInfo,
            type: "GET",
            dataType: "json",
            headers: { "accept": "application/json;odata=verbose" },
            success: mySuccessH,
            error: myErrHandler
        });

    });
}

but I can't get it to populate the 2nd table which is located right below the first table.

 <table id="tablePending" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th width="30%">Check</th>
                <th width="5%">ID</th>
                <th width="25%">Name</th>
                <th width="20%">Start Date</th>
                <th width="20%">End Date</th>
           </tr>
        </thead>
        <tfoot> </tfoot>
    </table>
    <p>&nbsp;</p><p>&nbsp;</p>
    <table id="tableAllAbs" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>

                <th width="5%">ID</th>
                <th width="20%">Name</th>
                <th width="20%">Request Type</th>
                <th width="20%">Start Date</th>
                <th width="20%">End Date</th>
                <th width="15%">Status</th>
           </tr>
        </thead>
        <tfoot> </tfoot>
    </table>

How can I fix TypeError: i is undefined?

$
0
0

I keep getting a "TypeError: i is undefined" error(datatables.min.js:36:271). I using datatables with php. PHP outputs my data to the table.
...

$(document).ready(function() { $('#tiles').DataTable( { order: [[ 2, 'asc' ], [ 0, 'asc' ]] } ); });

...
PHP Code
...
<?php foreach ($results as $row) { echo "<tr>

".$row->id.""; echo "id.");'>".$row->tile_name.""; echo "".$row->detail.""; echo "imageimage."' width='138' height='80' style='border:1px solid #999;'/>"; echo "".$row->providers.""; echo "".$row->states.""; if ($row->occurring == '2'){ echo "Yes"; } else { echo "No"; } echo "id.");'>delete_forever"; } ?>
...

Bootstrap 4 Beta 3: Paging Icons missing, Pagination Styling wrong

$
0
0

I've used DT in the past, but for a new project, I'm using the latest and greatest of everything. I'm using Bootstrap 4 Beta 3, and my tables don't look right. The up/down icons for column sorting are missing, and the styling on the pagination is wrong. This is a Rails 5 app, and I readily admit I'm more of a backend guy, so I suspect I didn't set up the CSS correctly. Appreciate any help.

DT Debugger output: http://debug.datatables.net/okudah
Screenshot: https://drive.google.com/open?id=15l_5BWPvQnj13xcTFZWcF2GdNo8TD50a

columnDefs.targets by class name not working when columns defined in JS

$
0
0

In a project I am working on, the HTML is simply an empty table. The data and columns are sent from an external ajax call. The columns are all assigned classes using className. When I try to add custom rendering to those columns using columnDefs, I am unable to use the classname of the column as the "targets". I have to specify the columns by index number. Is that working as intended?

I created a demo of the issue at http://live.datatables.net/sisigaca/1/edit The first table has columns defined by JS, and the second table has columns defined in HTML, and you can see that the Age column is formatted "properly" in the second table but not the first. I tried to make the example as close to my production environment as I could using sample data.


Anyone used a carousel within a datatable.

$
0
0

I have images and videos that I would like to show in a carousel.

Is it possible to use render to populate a carousel. So instead of the client having to scroll down a cell then can use the carousel.

Any ideas or links appreciated please.

Cheers

Steve Warby

Opening child row for all selected rows.

$
0
0

I need a button which will open child rows for all selected rows.
Assuming this is a valid way to obtain the selected rows:

var selectedRows = oTable.rows({ selected: true }).row();

how can I apply row.child.show() to each item in selectedRows?
Or am I missing a better way?

too SLOW issue

$
0
0

I got a 10M entries table. Even with Server-side processing. It takes more than 30 seconds to show the Next page (10 entries). Any ideal why? any solutions?

Vulnerabilities with dataTables server side processing

$
0
0

I was working on a project and I needed to output user details unto dataTables from PHP MYSql. DataTable requires results to be json encoded from php but it receives it as a get mothod in javascript. Problem is that the entire results is been shown on the browser console. I just wanted it to parse straight to window but dataTables leaves references on the browser console which can cause XSS attackes because I was able to hack my data using those information on the console

After clearing filter input box, getting error Cannot use 'in' operator to search for 'length' in

$
0
0

I have HTML table rendered from REST data (spring, thymeleaf). on page load I am configuring HTML table to DataTable. Everything works fine except initial load with blank search I am getting an error,
'Cannot use 'in' operator to search for 'length' in' and also sorting not working.

If I put any text in search box, filter and sorting both works fine without throwing any error.

var table = $('#example').DataTable({
"serverSide": false,
"searching": true,
"order": [[ 0, "asc" ]],
"search": {
"text": "Filter",
"search": ""
},
"columnDefs": [
{ "searchable": true, "type":"display", "orderable": false, "targets": "classsid", "data": "security_id"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classsread", "data": "read"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classswrite", "data": "write"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classsadmin", "data": "admin"
}
],
"dom": '<"#top.topClassI"f>rt<"#bottom.bottomClass"ipl><"clear">'
});

Use data from one datatable to create another datatable?

$
0
0

Is it possible to create a second datatable by using data from the first data table? I'm on SharePoint Online/Office 365. Using REST, I populated the first datatable with all 'pending' items. In my datatable settings, I added a column for user to 'check' other approved absence requests within the same date range as the current request.

"aoColumns": [
                {//check link
                    "render": function(data, type, row) {
                        var rowID = row.ID;
                        var rowEventDate = row.StartDateISO;
                        var rowEndDate = row.EndDateISO;
                        return  '<a href="javascript:modCheck(' + rowEventDate + "," + rowEndDate + ');">Check</a>';
                    }
                },

When user clicks the [check] link, it should populate another datatable

function modCheck(rowEventDate, rowEndDate) {

        var webAbsUrl = _spPageContextInfo.webAbsoluteUrl;
        var checkInfo = webAbsUrl + "/_api/web/Lists/getByTitle('AbsenceRequest')/Items?$filter=((StartDateISO ge datetime'" + rowEventDate.toISOString() + "') and (EndDateISO le datetime'" + rowEndDate.toISOString() + "'))&$select=Id, Absentee, RequestType, ActivityType, EventDate, EndDate, Status";

        var ajaxAllAbsences = $.ajax({
            url: checkInfo,
            type: "GET",
            dataType: "json",
            headers: { "accept": "application/json;odata=verbose" },
            success: mySuccessH,
            error: myErrHandler
        });

    });
}

but I can't get it to populate the 2nd table which is located right below the first table.

 <table id="tablePending" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th width="30%">Check</th>
                <th width="5%">ID</th>
                <th width="25%">Name</th>
                <th width="20%">Start Date</th>
                <th width="20%">End Date</th>
           </tr>
        </thead>
        <tfoot> </tfoot>
    </table>
    <p>&nbsp;</p><p>&nbsp;</p>
    <table id="tableAllAbs" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>

                <th width="5%">ID</th>
                <th width="20%">Name</th>
                <th width="20%">Request Type</th>
                <th width="20%">Start Date</th>
                <th width="20%">End Date</th>
                <th width="15%">Status</th>
           </tr>
        </thead>
        <tfoot> </tfoot>
    </table>

"ReferenceError: table is not defined" and ""Uncaught TypeError: table.row is not a function"

$
0
0

It seems that if you use "dataTable" instead of "DataTable" during initialization, you will get an error when you try to access it later.

For example:

datatables_viewer = $('#myTable').dataTable({...}); // Note lower-case "D"

datatables_viewer.on( 'click', 'tr', function (){
    // Get the rows id value
    currentlySelectedId = datatables_viewer.row( this ).id();
    console.log("Currently Selected ID: " + currentlySelectedId);
});

Will not work, returning an error of:

"Uncaught TypeError: datatables_viewer.row is not a function"

But changing the "d" to an uppercase solves the issue.

Thanks to these posts to help me figure out the issue.

https://datatables.net/forums/discussion/comment/87890/#Comment_87890
https://datatables.net/forums/discussion/comment/76389/#Comment_76389

I thought "dataTable" was the new naming convention?


style in body for PDF export

$
0
0

I have a table with many columns that I can not ignore and a viable arrangement is to decrease the size of the letters so that when generating the PDF you can see the whole table and not a part of it. Can someone help me please. I know I can do character replacement but I do not know how to affect the whole style of the data in the rows and columns. Thank you very much!

Convertir celdas a mayusculas

$
0
0

Hola a todos !

Tengo un ajax que me devuelve objetos en minúsculas y otras en mayúsculas. Pero quiero que sean todas las celdas en mayúsculas.

Aquí recepciono la data del api.

columns: [
                    {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"}
                ],

Gracias y saludos desde Perú.

Adding a class to a row on DataTables initialization

$
0
0

Is there a way to identify criteria to add a class to a <tr> to highlight certain rows on initialization?

use Excel and print with external button

$
0
0

hello alan

i want to export data using excel and print ...
so how can i print and export data by using another customised button without using data-table toolbar print and excel button...
i need to use as like add /edit /duplicate with external hyperlink refren

<a class="editor.create"></a>

regards
karthik.r

Using $Where on Class Datatables

$
0
0

Hello Allan, Happy New Year
Wish a better year for you

I want to use where with condition

->select(
 'v_item_pr_po',
 ['item_code as value', 'item_name as label'],
 ['pr_no' => $_REQUEST['values']['prnumber'] ) **AND here**

I want to add q_po > 0
I tried some, but no luck, please advise

Regards,
Danny

Viewing all 81687 articles
Browse latest View live


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