Cannot read property 'style' of undefined

Cannot read property 'style' of undefined

latheefplatheefp Posts: 10Questions: 2Answers: 0
edited July 2016 in Free community support

I am getting "Cannot read property 'style' of undefined" error when I add below part to my colums. else its working fine.

>
 {
>                 data: null,
>                 className: "center",
>                 defaultContent: '<a href="" class="editor_edit">Edit</a> / <a href="" class="editor_remove">Delete</a>'
>             }

Full code.

 $('#servertable').DataTable( {
            "ajax": "/servers/getdata",
            "processing": true,
            "serverSide": true,
            "pageLength": 50,
            "fixedHeader": true,
            "bLengthChange": true,
            "fixedHeader": true,
            dom: 'Bfrtip',
            "columns": [
                    {"data":"Hostname", "name":"hostname", "width":100, "searchable":true},
{"data":"OS", "name":"os_type", "width":0, "searchable":true},
{"data":"OS Version", "name":"os_version", "width":0, "searchable":true},
{"data":"Location", "name":"location", "width":0, "searchable":true},
{"data":"HW Type", "name":"hw_type", "width":0, "searchable":true},
{"data":"Vendor", "name":"vendor", "width":0, "searchable":true},
{"data":"Baseline", "name":"baseline", "width":0, "searchable":true},
{"data":"Project", "name":"project", "width":0, "searchable":true},
{"data":"Application", "name":"applications", "width":300, "searchable":true},
{"data":"HW Model", "name":"hw_model", "width":0, "searchable":true},
{"data":"Serial", "name":"serial", "width":0, "searchable":true},
{"data":"CPU", "name":"cpu_core", "width":30, "searchable":true},
{"data":"Memory", "name":"memory", "width":0, "searchable":true},
{"data":"Support Level", "name":"supportlevel", "width":0, "searchable":true},
{"data":"Host IP", "name":"host_ip", "width":0, "searchable":true},
{"data":"Ethernet IPs", "name":"ethernet_ips", "width":300, "searchable":true},
{"data":"Console", "name":"console", "width":300, "searchable":true},
{"data":"Owner", "name":"owners", "width":300, "searchable":true},
{"data":"SLA", "name":"sla", "width":300, "searchable":true},
{"data":"RFS Number", "name":"rfs_number", "width":300, "searchable":true},
{"data":"RFS Requester", "name":"rfs_requester", "width":300, "searchable":true},
{"data":"Live", "name":"live", "width":300, "searchable":false},
{"data":"Commissioned on", "name":"date_commission", "width":300, "searchable":true},
{"data":"Decommission on", "name":"date_decommission", "width":300, "searchable":true},
{"data":"Host Type", "name":"host_type", "width":300, "searchable":true},
{"data":"DR Host", "name":"dr", "width":0, "searchable":true},
{"data":"DMZ", "name":"dmz", "width":0, "searchable":false},
{"data":"Infra", "name":"infra", "width":0, "searchable":false},
                                    
            {
                data: null,
                className: "center",
                defaultContent: '<a href="" class="editor_edit">Edit</a> / <a href="" class="editor_remove">Delete</a>'
            }
                                    
                ],

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • allanallan Posts: 62,301Questions: 1Answers: 10,216 Site admin

    You have 29 columns in your columns array. My guess is that your HTML doesn't match up with that (perhaps only 28 columns?).

    However, without a link to a test case, that is purely a guess. Please link to a test case showing the issue (per the forum rules) if that isn't the issue.

    Allan

This discussion has been closed.