Uncaught TypeError: Cannot read property 'infoThousands' of undefined

时间:2016-04-07 10:40:48

标签: javascript jquery json datatables

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

working with jquery datatable. Table record going above thousand rows

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

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

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 个答案:

答案 0 :(得分:0)

之前你有一个额外的结束括号}
    ...  
    details += full.Country + '<br> '
   }
 }
 if (full.PhoneNo != '' && full.PhoneNo != undefined) {
 ....

也许删除它会有所帮助