首页 > 解决方案 > 数据表不显示

问题描述

我这里有一个点击事件,它显示 jquery 确认中的表数据,但数据表不会显示,即使只显示数据表也不起作用,它只显示普通表。你能告诉我为什么不工作的问题是什么。先感谢您。我把我的表放在 jquery 确认并创建一个数据表函数。

   $(document).on('click','.btnNotifyRecom',function (){

       var BranchCode = $(this).attr("id");
        var TranNo = $(this).attr("data-value");
        var TranType = $(this).attr("data-value1");

         $.confirm({
            title: 'Notify to Payroll Department',
            content: '' +
                '<form action="" class="formName">' +
                '<div class="form-group">' +
                '<label>Select Employee</label>' +

                 '<input class="form-control employees MySelect Content" placeholder="Enter ID/Name" list="employeename" id="EmployeeID" />'+
                 '<datalist id="employeename" class="EmployeeIDsubmit" style="width:10%"></datalist>'+

                '</select>' +
                '</div>' +
                 '</form>' +
                 '<table id="NotifyTable" class="table table-striped table-bordered table-sm cell-border compact stripe" style="width:100%; margin-top: 10px;"> '+
                '<thead><tr><th>Employee</th><th>Notify Date</th></tr></thead>' +
                ' <tbody id="NotifyTable"></tbody>' +

                '</table>',



            buttons: {
                formSubmit: {
                    text: 'Submit',
                    btnClass: 'btn-blue',
                    action: function () {
                        var Content = this.$content.find('.Content').val();
                        if (!Content) {
                            $.alert('Please Select Employee');

                            return false;
                        }
                        else {

                            $.ajax({
                                type: 'POST',
                                dataType: "json",
                                url: '@Url.Action("SubmitNotifyUser", "SummaryOBTOA")',
                                data: {
                                    'TranNo': TranNo,
                                    'BranchCode': BranchCode,
                                    'TranType': TranType,
                                    'Content': Content,
                                    'Action': 'NotifyRecome',
                                }
                            });


                            $.alert('Employee Number: ' + Content + ' has been notified');
                            return false; 
                        }
                    }
                },
                cancel: function () {
                    //close
                },
            },
            onContentReady: function () {
                // bind to events
                var jc = this;
                this.$content.find('form').on('submit', function (e) {
                    // if the user submits the form by pressing enter in the field.
                    e.preventDefault();
                    jc.$$formSubmit.trigger('click'); // reference the button and click it
                });
            }
         });


       $('#NotifyTable').DataTable({


        "language": {
            emptyTable: "No Transaction"

        },
        ajax: {
              url: '@Url.Action("GetNotifyUsers", "SummaryOBTOA")',
            data: {

            'TranNo': TranNo,
                'TranType': TranType,
                'BranchCode': BranchCode,
            'NotifyType':  'NotifyRecome',
                 },
            dataType: "json",
            retrieve: "true",
            processing: "true",
            serverSide: "true",

            type: "POST",
            dataSrc: "",

        },
        order: [],
        columnDefs: [
            {
                targgets: [1],
                orderable: false,
            }

                   ],

                    columns: [

            { data: "EmpName" },
            { data: "NotifyDate" }


                ]

               });

              });

标签: javascriptajax

解决方案


推荐阅读