Editor Error - Cannot read property 'oFeatures' of undefined

Editor Error - Cannot read property 'oFeatures' of undefined

ricofunghlricofunghl Posts: 1Questions: 1Answers: 0

I am trying to use editor on datatable but whenever I pass the table option to the editor variable (which I must), it gives me errors upon clicking CREATE, EDIT or DELETE. I know the editor is loaded correct because when I remove the table option it works, albeit disconnected from the dataTable. Below is my code:

<table id="table">
    <thead>
        <tr>
            <th>id</th>
            <th>First name</th>
            <th>Last name</th>

        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

<script>

    var editor = new $.fn.dataTable.Editor( {
        table: "#table",
        ajax:  '/api/staff',
    
        fields: [
            { label: 'First name', name: 'first_name' },
            { label: 'Last name',  name: 'last_name'  }
            ]
    });

    $('#table').DataTable( {
        ajax: {
             processing: true,
             url: "{% url 'business_process_json' %}",
             dataSrc: ""
         },
        dom: 'Bfrtip',
        columns: [
            { data: "pk" },
            { data: "fields.first_name" },
            { data: "fields.last_name" },
        ],
        buttons: [{
            extend: 'create',
            editor: editor
        },{
            extend: 'edit',
            editor: editor
        },{
            extend: 'remove',
            editor: editor
        },{
            extend: 'collection',
            text: 'Export',
            buttons: [
                'copy',
                'excel',
                'csv',
                'pdf',
            ]
        }
        ],
        select: true
    } );

</script>

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Can you tell us what errors you're being given? Are you able to link to your page so we can see.

    Colin

This discussion has been closed.