Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81909

TypeError: f[b] is not a function when clicking Update, New, Delete button

$
0
0

The table renders and displays the data yet, when trying to edit, delete, or add a new record, I get error:
TypeError: f[b] is not a function

Here is the debug:
http://debug.datatables.net/alujin

Here is the code:

var editor; // use a global for the submit and return data rendering in the examples

$(document).ready(function () {

       editor = new $.fn.dataTable.Editor({
            ajax: "/api/StudentImmigrationNotesDT",
            model: "StudentImmigrationNotesModel",
            table: "#ImmigrationNotes",
            fields: [{
                    label: "Advised Date:",
                    name: "imnAdvisingDate",
                    type: "datetime"
            }, {
                    label: "Action Given:",
                    name: "imnAdvisingAction",
            }, {
                    label: "Advise Type:",
                    name: "imnAdvisingType",
           }, {
                    label: "Note:",
                    name: "imnAdvisingNote",
            }, {
                label: "Source:",
                name: "imnAdvisingSource",
           }, {
               label: "School ID:",
               name: "imnSchoolMasterID",
            }, {
                label: "Student ID:",
                name: "imnStudentUserID",
           }, {
               label: "Advise ID:",
               name: "imnImmigrationNoteID",
           }
            ]
        });

        // setup and establish the DataTable
        $("#ImmigrationNotes").DataTable({
            ajax: "/api/StudentImmigrationNotesDT",
            model: "StudentImmigrationNotesModel",
            // the columns used
            //data: data,
            columns: [
                { data: 'Advised Date' },
                { data: 'Action Given' },
                { data: 'Advise Type' },
                { data: 'Advise Note' },
                { data: 'Advise Source' },
                { data: 'School ID' },
                { data: 'Student ID' },
                { data: 'Advise ID' }
            ],
            // this sets the feedback text
            "oLanguage": {
                //"sUrl": "media/language/de_DE.txt",
                "sZeroRecords": "No records match your search criterion.",
                "sLengthMenu": "Display _MENU_ records per page.",
                "sInfo": "Displaying _START_ to _END_ of _TOTAL_ records.",
                "sInfoEmpty": "Showing 0 to 0 of 0 records.",
                "sInfoFiltered": "(Filtered from _MAX_ total records.)"
            },
            // this is for the copy, export to Excel, Print and PDF
            //dom: '<"top"fil<"toolbar">p>rt<"bottom"Bil>',
            dom: '<"top"r<"toolbar">fl>rt<"bottom"Bpi>',
            buttons: [
                {
                    extend: 'copyHtml5',
                    //ButtonText: 'Copy Page',
                    exportOptions: {
                        rows: ':visible',
                        columns: ':visible'
                    },
                },
                {
                    extend: 'csvHtml5',
                    //ButtonText: "Export to CSV",
                    exportOptions: {
                        rows: ':visible',
                        columns: ':visible'
                    },

                },
                {
                    extend: 'excelHtml5',
                    //ButtonText: "Export to CSV",
                    exportOptions: {
                        rows: ':visible',
                        columns: ':visible'
                    },
                },
                {
                    extend: 'pdfHtml5',
                    //ButtonText: "PDF",
                    exportOptions: {
                        rows: ':visible',
                        columns: ':visible'
                    },
                },
                {
                    extend: 'print',
                    //ButtonText: "Print",
                    exportOptions: {
                        rows: ':visible',
                        columns: ':visible'
                    },
                },
                //'selectedSingle',
                'selectAll',
                'selectNone',
                //'selectRows',
                //'selectColumns',
                //'selectCells',

                //// this hides or shows columns
                //{
                //    extend: 'collection',
                //    text: 'Toggle Visibility',
                //    buttons: [
                //        {
                //            text: 'Recalled',
                //            action: function (e, dt, node, config) {
                //                dt.column(6).visible(!dt.column(6).visible());
                //            }
                //        },
                //        {
                //            text: 'Action',
                //            action: function (e, dt, node, config) {
                //                dt.column(7).visible(!dt.column(7).visible());
                //            }
                //        }
                //    ]
                //},

                { extend: "create", editor: editor },
                { extend: "edit", editor: editor },
                { extend: "remove", editor: editor }

            ],

            // default settings
            keys: false, // single cell select if true
            info: true,
            sort: true,
            searching: true,
            select: true,
            ordering: true,
            order: [[0, 'desc']],
            scrollY: '50vh',
            scrollX: true,
            scrollCollapse: true,
            bJQueryUI: true,
            sPaginationType: "full_numbers",
            displayStart: 0,
            stateSave: true,
            autoWidth: true,
            paging: true,
            fixedHeader: true,
            fixedColumns: false,
            columnReorder: true,
            serverSide: false,
            processing: true,
            deferRender: true,
            responsive: true,

            //columnDefs: [
            //             { width: '20%', targets: 0 }
            //            ],
            lengthMenu: [[1, 5, 10, 25, 50, 100, -1], [1, 5, 10, 25, 50, 100, "All"]],
            iCookieDuration: 60 * 60 * 24, // 1 day keep cookie
        });

Viewing all articles
Browse latest Browse all 81909

Trending Articles



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