未捕获的TypeError:无法读取未定义的属性“infoThousands”

时间:2022-08-08 14:25:24

My Test Page at this link: http://graficali.com/lmg/infoThousands/infoThousands.aspx

我的测试页面链接:http://graficali.com/lmg/infoThousands/infoThousands.aspx

working with jquery datatable. Table record going above thousand rows

使用jquery数据表。表记录超过千行

getting following Error: Uncaught TypeError: Cannot read property 'infoThousands' of undefined

得到以下错误:未捕获的TypeError:无法读取未定义的属性'infoThousands'

its working fine , but in console window it shows mentioned error

它的工作正常,但在控制台窗口中显示提到的错误

is something wrong with my code..

我的代码有问题..

console window screenshot here : http://graficali.com/lmg/TypeError.png

控制台窗口截图:http://graficali.com/lmg/TypeError.png

My Code look like this

我的代码看起来像这样

  <script type="text/javascript">
        function GetFormatedDate(data) {
            var date = new Date(data);
            var dd = date.getDate();
            var mm = date.getMonth() + 1; //January is 0!
            var yyyy = date.getFullYear();
            if (dd < 10) {
                dd = '0' + dd
            }
            if (mm < 10) {
                mm = '0' + mm
            }
            date = mm + '/' + dd + '/' + yyyy;
            return date;
        }

        var oTable;
        function LoadSearchGrid() {

            var Name = $.trim($("#txtName").val());
            var SocialSecurity = $.trim($("#txtSocialSecurityNumber").val());
            var DriverLicense = $.trim($("#txtDriverLicenseNumber").val());

         
            IServiceCitizenMaster.GetDataCitizenMaster(0, '', Name, '', '', '', SocialSecurity, DriverLicense, '', 0, '', '', '', '', '', '', '', '', '', '', 0, 0, '', '', 'Y',
                                    function (data) {
                                        ooData = JSON.parse(data);
                                        if (oTable != null) {
                                            oTable.fnClearTable();
                                            oTable.fnAddData(ooData);
                                        }
                                        else {
                                            oTable = $('#tblCitizenMaster').dataTable({

                                                "createdRow": function (row, data, index) {
                                                    //$('td', row).eq(3).addClass('highlight');
                                                },
                                                "sorting": [[1, "asc"]],
                                                rowCallback: function (row, data, iDisplayIndex, iDisplayIndexFull) {
                                                    var index = iDisplayIndexFull + 1;
                                                    $('td:eq(0)', row).html(index);
                                                    return row;
                                                },
                                                data: ooData,
                                                'iDisplayLength': 50,
                                                "sPaginationType": "full_numbers",
                                                "oLanguage": {
                                                    "sSearch": "Search within data :",
                                                    "sEmptyTable": "No data available" ,
                                                   
                                                },
                                                columns: [
                                               
                                                {data: null, title: "#", width: "3%", sortable: false },
                                                { data: null, title: "Full Name", width: "15%",
                                                    render: function (data, type, full) {
                                                        var details = full.Title + ' ' + full.FName + ' ' + full.LName + '<br>';
                                                        if (full.DateOfBirth != '' && full.DateOfBirth != undefined) {
                                                            details += 'Date Of Birth: ' + GetFormatedDate(full.DateOfBirth) + '<br> '
                                                        }
                                                        if (full.Gender != '' && full.Gender != undefined) {
                                                            details += 'Gender: ' + full.Gender + '<br> '
                                                        }
                                                        if (full.Ethnicity != '' && full.Ethnicity != undefined) {
                                                            details += 'Ethnicity: ' + full.Ethnicity + '<br> '
                                                        }
                                                        return details;
                                                    }
                                                },
                                                { data: null, title: "Contact Details", width: "15%",
                                                    render: function (data, type, full) {
                                                        var details = '';
                                                        if (full.PhoneHome != '' && full.PhoneHome != undefined) {
                                                            details += 'Phone Home: ' + full.PhoneHome + '<br> '
                                                        }
                                                        if (full.PhoneWork != '' && full.PhoneWork != undefined) {
                                                            details += 'Phone Work: ' + full.PhoneWork + '<br> '
                                                        }
                                                        if (full.Mobile != '' && full.Mobile != undefined) {
                                                            details += 'Mobile: ' + full.Mobile + '<br> '
                                                        }
                                                        if (full.EmailID != '' && full.EmailID != undefined) {
                                                            details += 'EmailID: ' + full.EmailID + '<br> '
                                                        }
                                                        return details;
                                                    }
                                                },
                                                  { data: null, title: "Address", width: "25%", sortable: false,
                                                      render: function (data, type, full) {
                                                          var details = '';
                                                          if (full.Addr1 != '' && full.Addr1 != undefined) {
                                                              details += full.Addr1 + '<br> '
                                                          }
                                                          if (full.Addr2 != '' && full.Addr2 != undefined) {
                                                              details += full.Addr2 + '<br> '
                                                          }
                                                          if (full.Street != '' && full.Street != undefined) {
                                                              details += full.Street + '<br> '
                                                          }
                                                          if (full.State != '' && full.State != undefined) {
                                                              details += full.State + '<br> '
                                                          }
                                                          if (full.City != '' && full.City != undefined) {
                                                              details += full.City + ' - ' + full.Zip + '<br> '
                                                          }
                                                          if (full.Country != '' && full.Country != undefined) {
                                                              details += full.Country + '<br> '
                                                          }
                                                                                                         
                                                          if (full.PhoneNo != '' && full.PhoneNo != undefined) {
                                                              details += 'PhoneNo: ' + full.PhoneNo + '<br> '
                                                          }
                                                          return details;
                                                      }
                                                  },
                                                     { data: null, title: "Other Details", width: "15%",
                                                         render: function (data, type, full) {
                                                             var details = '';
                                                             if (full.CompanyName != '' && full.CompanyName != undefined) {
                                                                 details += 'Company Name: ' + full.CompanyName + '<br> '
                                                             }
                                                             if (full.CitizenType != '' && full.CitizenType != undefined) {
                                                                 details += 'Citizen Type: ' + full.CitizenType + '<br> '
                                                             }
                                                             if (full.SocialSecurityNumber != '' && full.SocialSecurityNumber != undefined) {
                                                                 details += 'Social Security Number: ' + full.SocialSecurityNumber + '<br> '
                                                             }
                                                             if (full.DriverLicenseNumber != '' && full.DriverLicenseNumber != undefined) {
                                                                 details += 'Driver License Number: ' + full.DriverLicenseNumber + '<br> '
                                                             }
                                                             if (full.DriverLicenseState != '' && full.DriverLicenseState != undefined) {
                                                                 details += 'Driver License State: ' + full.DriverLicenseState + '<br> '
                                                             }
                                                             if (full.SeniorCitizenCode != '' && full.SeniorCitizenCode != undefined) {
                                                                 details += 'Senior Citizen Code: ' + full.SeniorCitizenCode + '<br> '
                                                             }

                                                             return details;
                                                         }
                                                     },
                                                     { data: "CitizenID", title: "", width: "5%", render: function (data) {
                                                         return "<i class='fa fa-pencil'  style='font-size:large;cursor:pointer' title='Edit' onclick='return EditRecord(" + data + ");'></i>&nbsp;&nbsp;<i class='fa fa-trash' style='color:red;font-size:large;cursor:pointer'   title='Delete' onclick='return ConfirmDelete(" + data + ");'></i>";
                                                     }, sortable: false
                                                     }
                                                 ]
                                            });

                                        }
                                    }, function (error) {
                                        alert('error : ' + error);
                                    });

            return false;
        }

        $(document).ready(function () {
            LoadSearchGrid();
        });
    </script>

1 个解决方案

#1


0  

You have an extra closing braces } right before

你之前有一个额外的关闭括号}

    ...  
    details += full.Country + '<br> '
   }
 }
 if (full.PhoneNo != '' && full.PhoneNo != undefined) {
 ....

Maybe removing that will help

也许删除它会有所帮助

#1


0  

You have an extra closing braces } right before

你之前有一个额外的关闭括号}

    ...  
    details += full.Country + '<br> '
   }
 }
 if (full.PhoneNo != '' && full.PhoneNo != undefined) {
 ....

Maybe removing that will help

也许删除它会有所帮助