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

Invalid JSON response

$
0
0

Hello, when i use server-side processing i've got this error in a spring webservice "Invalid JSON response" my JSON response is "PD9waHAKCi8qCiAqIERhdGFUYWJsZXMgZXhhbXBsZSBzZXJ2ZXItc2lkZSBwcm9jZXNzaW5nIHNjcmlwdC4KICoKICogUGxlYXNlIG5vdGUgdGhhdCB0aGlzIHNjcmlwdCBpcyBpbnRlbnRpb25hbGx5IGV4dHJlbWVseSBzaW1wbHkgdG8gc2hvdyBob3cKICogc2VydmVyLXNpZGUgcHJvY2Vzc2luZyBjYW4gYmUgaW1wbGVtZW50ZWQsIGFuZCBwcm9iYWJseSBzaG91bGRuJ3QgYmUgdXNlZCBhcwogKiB0aGUgYmFzaXMgZm9yIGEgbGFyZ2UgY29tcGxleCBzeXN0ZW0uIEl0IGlzIHN1aXRhYmxlIGZvciBzaW1wbGUgdXNlIGNhc2VzIGFzCiAqIGZvciBsZWFybmluZy4KICoKICogU2VlIGh0dHA6Ly9kYXRhdGFibGVzLm5ldC91c2FnZS9zZXJ2ZXItc2lkZSBmb3IgZnVsbCBkZXRhaWxzIG9uIHRoZSBzZXJ2ZXItCiAqIHNpZGUgcHJvY2Vzc2luZyByZXF1aXJlbWVudHMgb2YgRGF0YVRhYmxlcy4KICoKICogQGxpY2Vuc2UgTUlUIC0gaHR0cDovL2RhdGF0YWJsZXMubmV0L2xpY2Vuc2VfbWl0CiAqLwoKLyogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqCiAqIEVhc3kgc2V0IHZhcmlhYmxlcwogKi8KCi8vIERCIHRhYmxlIHRvIHVzZQokdGFibGUgPSAnQ09NUFRFJzsKCi8vIFRhYmxlJ3MgcHJpbWFyeSBrZXkKJHByaW1hcnlLZXkgPSAnQ1BUX09SRFJFJzsKCi8vIEFycmF5IG9mIGRhdGFiYXNlIGNvbHVtbnMgd2hpY2ggc2hvdWxkIGJlIHJlYWQgYW5kIHNlbnQgYmFjayB0byBEYXRhVGFibGVzLgovLyBUaGUgYGRiYCBwYXJhbWV0ZXIgcmVwcmVzZW50cyB0aGUgY29sdW1uIG5hbWUgaW4gdGhlIGRhdGFiYXNlLCB3aGlsZSB0aGUgYGR0YAovLyBwYXJhbWV0ZXIgcmVwcmVzZW50cyB0aGUgRGF0YVRhYmxlcyBjb2x1bW4gaWRlbnRpZmllci4gSW4gdGhpcyBjYXNlIHNpbXBsZQovLyBpbmRleGVzCiRjb2x1bW5zID0gYXJyYXkoCiAgICBhcnJheSggJ2RiJyA9PiAnUEVSU19JRCcsICdkdCcgPT4gMCApLAogICAgYXJyYXkoICdkYicgPT4gJ0NQVF9MT0dJTicsICAnZHQnID0+IDEgKSwKICAgIGFycmF5KCAnZGInID0+ICdDUFRfRU1BSUwnLCAgJ2R0JyA9PiAyICksCiAgICBhcnJheSgKICAgICAgICAnZGInICAgICAgICA9PiAnRF9NT0RJRklDQVRJT04nLAogICAgICAgICdkdCcgICAgICAgID0+IDMsCiAgICAgICAgJ2Zvcm1hdHRlcicgPT4gZnVuY3Rpb24oICRkLCAkcm93ICkgewogICAgICAgICAgICByZXR1cm4gZGF0ZSggJ2pTIE0geScsIHN0cnRvdGltZSgkZCkpOwogICAgICAgIH0KICAgICksCiAgICBhcnJheSgKICAgICAgICAnZGInICAgICAgICA9PiAnQ1BUX0NSWVBURScsCiAgICAgICAgJ2R0JyAgICAgICAgPT4gNCwKICAgICAgICAnZm9ybWF0dGVyJyA9PiBmdW5jdGlvbiggJGQsICRyb3cgKSB7CiAgICAgICAgICAgIHJldHVybiBudW1iZXJfZm9ybWF0KCRkKTsKICAgICAgICB9CiAgICApLAogICAgYXJyYXkoCiAgICAgICAgJ2RiJyAgICAgICAgPT4gJ0NQVF9NT0RJRklDQVRFVVInLAogICAgICAgICdkdCcgICAgICAgID0+IDUsCiAgICAgICAgJ2Zvcm1hdHRlcicgPT4gZnVuY3Rpb24oICRkLCAkcm93ICkgewogICAgICAgICAgICByZXR1cm4gbnVtYmVyX2Zvcm1hdCgkZCk7CiAgICAgICAgfQogICAgKQopOwoKLy8gU1FMIHNlcnZlciBjb25uZWN0aW9uIGluZm9ybWF0aW9uCiRzcWxfZGV0YWlscyA9IGFycmF5KAogICAgJ3VzZXInID0+ICdncmh1bScsCiAgICAncGFzcycgPT4gJ3NwcjNpb3UnLAogICAgJ2RiJyAgID0+ICdqZWZ5dGVzdCcsCiAgICAnaG9zdCcgPT4gJ29yYWNsZTIuY3JpLnVsbToxNTIxJwopOwoKCi8qICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKiAqICogKgogKiBJZiB5b3UganVzdCB3YW50IHRvIHVzZSB0aGUgYmFzaWMgY29uZmlndXJhdGlvbiBmb3IgRGF0YVRhYmxlcyB3aXRoIFBIUAogKiBzZXJ2ZXItc2lkZSwgdGhlcmUgaXMgbm8gbmVlZCB0byBlZGl0IGJlbG93IHRoaXMgbGluZS4KICovCgpyZXF1aXJlKCAnc3NwLmNsYXNzLnBocCcgKTsKCmVjaG8ganNvbl9lbmNvZGUoCiAgICBTU1A6OnNpbXBsZSggJF9HRVQsICRzcWxfZGV0YWlscywgJHRhYmxlLCAkcHJpbWFyeUtleSwgJGNvbHVtbnMgKQopOwo="

When i tried without my webservice it's ok but with spring it doesn't work... any idea ?
thanks


.Net Editor library is encoding text when writing to DB

$
0
0

I am using Editor .NET Framework libraries v1.8.1 and mssql server.
When Editor writes to a varchar() field, the text is html encoded
i.e. "&" is written as "&"

Is there a way to disable this encoding?

Excel Export Customize

$
0
0

I need to put a logo in the head of the Excel file exported from the Datatable, is it possible with the customize option?

quickler

$
0
0

how to order a record for example id, code, name but that I ordered by code in a table

MVC + DataTables: Ajax error when loading base url. Works fine when adding home/Index to url

$
0
0

I am getting an ajax error when I try to load the base url for my MVC 5 application that uses DataTables. However, it works fine when I add Home/Index to the end of the url. How can I ensure that the base url works without throwing an ajax error?

Ajax:

            "ajax": {
                "url": "../Home/GetTaskLogList",
                "type": 'POST',
                "content-type": "application/json; charset=utf-8",
                "processData": false,
                "dataType": "json",
                "headers": "headers",
                "data": "window.JSON.stringify(obj)",
                //"headers": { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() },
                //"data": { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() },
                "traditional": true,
                "dataSrc": function (data) {
                    return JSON.parse(data);
                },
            },

Route config:

     public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

Scroll DataTable => Missing parameters on form submit

$
0
0

I'm trying to submit a form. Inside the form there is a table that is dynamically populated. 10 parameters are sent for each row. The submit works fine with small data but it seems to have a limit with large data. Some times the parameters of the first rows are missing and some times are the parameters of the last rows. This is totally random. But the limit seems to be always the same.

If I do not use Datatable the submit works just fine. Even if I'm not using pagination, Datatable is limiting the number of rows the form can POST.

Here is the DataTable code:

$('#tbl-stats').DataTable({
            deferRender: true,
            scrollY:     400,
            scroller:    true
});

I'm using DataTables 1.10.18 & jQuery v3.3.1

My users are used to DataTables and I'll want to continue using it. Any ideas on how to avoid that limit?

I've already tried this but result is still the same: https://www.gyrocode.com/articles/jquery-datatables-how-to-submit-all-pages-form-data/

Thanks in advance for your help!

Textbox encoding

$
0
0

hello

I hope someone can help me. I have some troubles with special characters and my knowledge and the web couldn’t help me.
It look's like datatables writes/encodes not very propper:

I'm using .NET framework and MS SQLEXPRESS 2017 (SQL_Latin_General_CP850_CI_AS)

line 1 was created with datatables

line 2 was created with SQL-Query

In the header of the html file i'm using:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

and in web.config:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" />

Response:
{"draw":null,"data":[{"DT_RowId":"row_6","tooltype":"&#230;","toolname":"&#230;","modell":"&#230;","serial":"&#230;","merknad":"&#230;","arsmodell":"&#230;","lokasjon":"&#230;"}],"recordsTotal":null,"recordsFiltered":null,"error":null,"fieldErrors":[],"id":null,"meta":{},"options":{},"files":{},"upload":{"id":null},"debug":null,"cancelled":[]}

Orthogonal editor php

$
0
0

Hi there,

Is there a php function in editor to provide orthogonal data?
If not, would it be possible to provide a subarray instead of the value for a field?
Providing the different data types in php would be mich easier for me, because I have already many of the needed functions... how do you handle this „problem“?

Thx!
Bernhard


possibility to address columns by name instead of index

$
0
0

Hi there,

it might be a stupid question, but I did not find anything about this topic in the forum.

Is there a possibility to address columns with names instead of array indices?
To make my question clearer: When I have to change the table for some reason, I would have to change all functions
containing an index - e.g.: order: [[4, 'asc']], - If I would insert a column to the front of the table at a later point, I would have to
recode all the indices. If there was a field name e.g. [[last_name, 'acs']] , the problem with recoding would not exist. So it would me much easier to maintain.

Thx,
Bernhard

DataTable - i18n() function inside constructor

$
0
0

I defined something like that

 $.extend( true, $.fn.dataTable.defaults, {
 [...]
"language": {
      "url": contextPath + "/resources/i18n/jquery.datatable.messages_" + GLOBAL_LOCALE + ".json"
    },
[...]

When I define a dataTable how can I access i18n function inside datatable?

 var table = $('#table').DataTable({
[...]

  "columns": [
              {"data": "project.name"},
              {"data": "project.title"}, 
              {
                "data": function (row, data, index) {
                       // HERE HOW CAN I INVOKE i18n() function? this.i18n('token','default') doesn't work.            
                     }


})

Any way to submit changes to just one field?

$
0
0

Is there a way in bubble edit to just submit changes to that field? I have bubble set up to individual fields. Sometimes when I change one field it updates another that I don't wont updated yet

Ajax Reload keep the Child rows open but also writes data to another child,

$
0
0

I somehow managed to make it working, but now i have a situation where i had opened two parents and adding the data in one parent and reloading, it shows in both now even after refresh it shows it been added in one, how can i fix that

$('body').on('click', '#add', function() {
 var id= $("#id").val();
$.ajax({url:page.cfm',type:post,data : {id: id},async:false,datatype:'json',success: function(data) {
if (data.status == 1) {
                            swal('', data.statusmsg, 'success');
                            table.ajax.reload(function () {
                            //Iterate through all the open rows and open them again 
                            table.rows(rowIds).every(function (row, index, array) {
                                table.row(row).child(Format(ID)).show(); - ID coming from post call
                                this.nodes().to$().children('td:first').html('<i class="fa fa-minus-square text-danger fa-2x" aria-hidden="true"></i>');
                            });
                            //Set to false if you don't want the paging to reset after ajax load,otherwise true
                        }, false);

}
});
});

now after the success call, the format Function will be called as many times as the parent row is opened and redrawn, but it is always sending the same ID

how can fix it

If you reload the page is it ok? - YES

When you say you have 2 parents you mean 2 different rows? - YES

The Issue is happening on table redraw of Datatables

local storage, save state

$
0
0

https://datatables.net/extensions/keytable/examples/initialisation/stateSave

Question 1: Can this be initialized via data tags? I tried data-state-save="true" and data-keys="true" but that didn't seem to work.

Question 2: I have a table with column filters. It looks like it's restoring state correctly with the filters that I specified, but It doesn't repopulate the search params in the column filters themselves (so the user can't tell easily that it's actually a filtered list).

Select which columns will be marked as Child rows (show extra / detailed information)

$
0
0

I have a datatable with a couple of columns like "comments" and extra details that will probably contain a lot of text. I would like to choose which columns will be visible by default and mark the ones that will contain a lot of text as extra information so that they will not visible when the datatable loads at first but will be visible once the user clicks on the + button to show the extra columns.

Here is screenshot of the issue I'm having at the moment.

.rows() method returns unexpected result

$
0
0

I have my DataTable, like that:

var myData = [
    {item: 'apple', color: 'red'},
  {item: 'pear', color: 'green'},
  {item: 'pinaple', color: 'yellow'},
  {item: 'banana', color: 'yellow'}
];

var dataTable = $('#mytable').DataTable({
    sDom: 't',
  data: myData,
  columns: [
    {data: 'item', title: 'item'},
    {data: 'color', title: 'color'}
  ]
});

var selectedRow = dataTable.rows(1,{order:'applied'}).data();
$('#requested').text(JSON.stringify(selectedRow[0]));

And the question is why .rows(1, {order:'applied'}) refers to the second row of source data set and not actual current table layout?

Here is a playground.


Removing sorting arrows AND space they would occupy from header

$
0
0

I know using the following removes the sorting arrows:

columnDefs: [
{
targets: 0,
orderable: false
},

However, the space they would occupy remains. This makes my details-control icons off-center, and I can't find a way to center them with that padding present. Is there a way to shrink the header column, removing the space the sorting arrows would normally occupy?

How to filter datatable with value add with jquery

$
0
0

Hello,

I m using Datatable and i trying to filter value on my last td colomun on text Red or white value..
When i clicked on arrow's filter nothing is happening (no filter action)..
Do you know why?

$('#sst-table-all-contracts').DataTable
({
'createdRow': function (row, data) {
$(row).find("td:eq(1)").attr("id", data[6]);

                            if (data[7] == null )
                            {
                                $(row).find('td:last').css("background", "white");
                                $(row).find('td:last').text("white");
                                $(row).find('td:last').css("color", "white");

                            }
                            else {

                                $(row).find('td:last').css("background", "red");
                                $(row).find('td:last').text("red");
                                $(row).find('td:last').css("color", "red");

                            }

                            },
                        "aaData": contractsList,
                        "aoColumns": [ {}, {}]

                              });

colVis with checkboxes

$
0
0

Hello,

I need code for colVis with checkboxes

How do I disable cell overflow?

$
0
0

For some reason my table cells are overflowing into following cells. This only happened when I started using the scrollX function. If I disabled scrollX the problem goes away. Is there a way to fix this?

Picture

$('#example').DataTable().column(4).data().sum(); returning 0

$
0
0

Sample case: https://datatables-ecommerence.000webhostapp.com/
I have no errors on the console or w3validator.

` <script src="https://cdn.datatables.net/plug-ins/1.10.19/api/sum().js"></script>`
    $(document).ready(function() {
      var sum = $('#example2').DataTable().column(4).data().sum();
      $('#total').html(sum);
    });

I tried other columns too and they all return 0.

=====

Since I have two tables, I may have to make my own personal script because https://cdn.datatables.net/plug-ins/1.10.19/api/sum().js uses example (not example2). That is the only thing I can think of that could be wrong.

I will post any other updates as I will be working on this for a while.

Viewing all 81403 articles
Browse latest View live


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