Mapping Error with jquery 2.1.4

Mapping Error with jquery 2.1.4

itwelveitwelve Posts: 2Questions: 1Answers: 0
edited November 2015 in Free community support

"Uncaught Unable to automatically determine field from source. Please specify the field name. For more information, please refer to https://datatables.net/tn/11"

If I connect 2.1.4 jquery instead of 1.11.3, I get the exception that displays in console. It happens when I click button "edit" in editable table

This is a part of code:

var editorCofiguration = {
            "serverSide": true,
            "ajax": {
                "url": url,
                "type": "POST",
                "data": editorRequestToJson,
                "dataType": "json",
                "contentType": "application/json; charset=utf-8"
            },
            "idSrc": "Id",
            "table": "#table",
            "fields": [
                {
                    "label": "Show Channel",
                    "name": "ShowChannel",
                    "type": "select",
                    "ipOpts": []
                },
                {
                    "label": "Subs Channel",
                    "name": "SubsChannel",
                    "type": "select",
                    "ipOpts": []
                },
                {
                    "label": "Channel Offset",
                    "name": "ChannelOffset",
                    "type": "hidden"
                },
                {
                    "label": "Start",
                    "name": "SwitchFrom",
                    "def": function () {
                        return new Date();
                    },
                    "dateFormat": "yyyy-mm-dd hh:mm",
                    "type": "date",
                    "attr": {
                        "type": "datetime-local",
                        "class": "datetime-picker"
                    }
                },
                {
                    "label": "Stop",
                    "name": "SwitchTill",
                    "def": function () {
                        return new Date();
                    },
                    "dateFormat": "yyyy-mm-dd hh:mm",
                    "type": "date",
                    "attr": {
                        "type": "datetime-local",
                        "class": "datetime-picker"
                    }
                }
            ]
        };

        var editor = new $.fn.dataTable.Editor(editorCofiguration);

var tableConfiguration = {
            "dom": "Bfrtip",
            "serverSide": true,
            "ajax": {
                "url": url,
                "type": "POST"
            },
            "processing": true,
            "info": true,
            "stateSave": true,
            "rowId": "Id",
            "columnDefs": [
                {
                    "targets": [ 5 ],
                    "visible": false
                }
            ],
            "lengthMenu": [[10, 20, 50, -1], [10, 20, 50, "All"]],
            "columns": [
                {
                    "data": "ShowChannelName",
                    "orderable": true
                },
                {
                    "data": "SubsChannelName",
                    "orderable": true
                },
                {
                    "data": "SwitchFrom",
                    "label": "Start:",
                    "name": "switch_from",
                    "orderable": true,
                    "type": "date",
                    "render": function(data) {
                        if (!data) {
                            return "Invalid Date";
                        }
                        return moment(data).format("YYYY-MM-DD HH:mm:ss");
                    }
                },
                {
                    "data": "SwitchTill",
                    "label": "Stop:",
                    "name": "switch_till",
                    "orderable": true,
                    "type": "date",
                    "render": function(data) {
                        if (!data) {
                            return "Invalid Date";
                        }
                        return moment(data).format("YYYY-MM-DD HH:mm:ss");
                    }
                },
                {
                    "data": "AddedBy",
                    "label": "Added By:",
                    "name": "added_by",
                    "orderable": true
                },
                {
                    "data": "ChannelOffset",
                    "label": "Channel Offset",
                    "name": "channel_offset"
                }
            ],
            "order": [[0, "asc"]],
            "select": true,
            "buttons": [
                { "extend": "create", "editor": editor },
                { "extend": "edit", "editor": editor },
                { "extend": "remove", "editor": editor }
            ]
        };
        

        var table = $("#table").DataTable(tableConfiguration);

Answers

  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin

    Just to check my understanding of the issue - if you use jQuery 1.x the issue doesn't occur. If you use 2.x it does?

    Are you using inline editing? If so, which column gives this error?

    Allan

  • itwelveitwelve Posts: 2Questions: 1Answers: 0
    edited November 2015

    Yes, you are right.

    Are you using inline editing

    Popup Editing.

    which column gives this error?

    Error occurs near this code:

    F = function(a, b, c, e, j, g) {
    var w2o = "ell";
    b(L8 + w2o + P0J.u6Y)k5o[q7o](function(c) {

    I look at the stack trace, Object 'a' in there looks good.

    Jquery 2.1.4 connected in ASP.Net Bundles, on layout. Only one sting added/removed on/from the page, brokes editing popup:

    Works:
    (Rewrites 2.1.4 to 1.11.3 (inside /jquery.min.js this version))


    (Uses 2.1.4 from bundles))

  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin

    This happens on all columns? Is there any chance you can give me a link to the page so I can try to debug it live? I've just tried it locally and wasn't able to reproduce the issue.

    Many thanks,
    Allan

This discussion has been closed.