jquery.dataTables.min.js:36 Uncaught TypeError: Cannot read property 'length' of undefined

jquery.dataTables.min.js:36 Uncaught TypeError: Cannot read property 'length' of undefined

alexkrushalexkrush Posts: 3Questions: 1Answers: 0

Hi all
having following html:

Url Edit
Risk
Tool Number
Tool T R H Id
Url Edit
Risk
Airbus Tool Number
Tool T R H Id
<script type="text/javascript">
    $(document).ready(function () {
        // Init DataTables
        var oTable = $('#Tools').DataTable({               
            "processing": true,
            "serverSide": true,
            "ajax": "/TR/GetTRData?toolTRHId=14"
        });
    });
</script>

and following json from link "/TR/GetTRData?toolTRHId=14":
[{"UrlEdit":"/TR/EditTR?toolTRHId=14","Risk":"","ToolNumber":"T000600500","ToolTRHId":14},{"UrlEdit":"/TR/EditTR?toolTRHId=14","Risk":"","ToolNumber":"T000600501","ToolTRHId":14}]

I'm getting the Uncaught TypeError.
Where I'm wrong?
Thanks a lot for help.
Alexander

This question has an accepted answers - jump to answer

Answers

  • alexkrushalexkrush Posts: 3Questions: 1Answers: 0

    Sorry, Repost with correct format:

    <table id="Tools">
            <thead>
                <tr>
                    <th>
                        <div class="display-label">
                            Url Edit
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                            Risk
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                           Tool Number
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                            Tool T R H Id
                        </div>
                    </th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th>
                        <div class="display-label">
                            Url Edit
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                            Risk
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                            Airbus Tool Number
                        </div>
                    </th>
                    <th>
                        <div class="display-label">
                            Tool T R H Id
                        </div>
                    </th>
                </tr>
            </tfoot>
            <tbody></tbody>
    
    </table>
    <script type="text/javascript">
            $(document).ready(function () {
                // Init DataTables
                var oTable = $('#Tools').DataTable({               
                    "processing": true,
                    "serverSide": true,
                    "ajax": "/TR/GetTRData?toolTRHId=14"
                });
            });
        </script>
    

    and following json from link "/TR/GetTRData?toolTRHId=14":

    [{"UrlEdit":"/TR/EditTR?toolTRHId=14","Risk":"","ToolNumber":"T000600500","ToolTRHId":14},{"UrlEdit":"/TR/EditTR?toolTRHId=14","Risk":"","ToolNumber":"T000600501","ToolTRHId":14}]

    I'm getting the Uncaught TypeError. Where I'm wrong? Thanks a lot for help. Alexander

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Hi,

    Good to hear you have got it fixed now. In future, could you please link to a test page showing the issue so we can help to debug it.

    Regards,
    Allan

This discussion has been closed.