Trying to setup editor for the first time, getting Cannot read property 'oFeatures' of undefined

Trying to setup editor for the first time, getting Cannot read property 'oFeatures' of undefined

cuscocusco Posts: 4Questions: 1Answers: 0

Hi,
This is my first attempt at editor, and I've set up a working example of datatables. Then I add editor code, still good. When I call editor.create() I get Cannot read property 'oFeatures' of undefined

here is my current code:

            editor = new $.fn.dataTable.Editor({
                ajax:   "a.php",
                table:  "#contactlist",
                fields: [
                            {label: 'teste1', name: 'exten'},
                            {label: 'teste2', name: 'name'}
                        ]
            });
            oTable = $('#contactList').dataTable({
                "dom"           : 'T<"clear">lfrtip',
                "tableTools"    : "swf/copy_csv_xls_pdf.swf",
                "aaSorting"     : [ [1,'asc'] ],
                "bProcessing"   : true,
                "lengthMenu"    : [ [50, 100, 500, -1], [50, 100, 500, "All"] ],
                "stateSave"     : true,
                "bStateSave"    : true,
                "ajax": {
                    url:        'getDetails.php',
                    type:       'POST',
                    dataType:   'json',
                    cache:      'false',
                    data:       {action: 'contactList'},
                    dataSrc:    "results"
                },
                aoColumns: [
                    {"data":    "exten"},
                    {"data":    "name"},
                ],

                "drawCallback": function( settings ) {
                    $('.toActivate').off('click');
                    $('.toDeactivate').off('click');
                    // button click bindings
                    $('.toActivate').on('click', function(e){
                        ext = this.id.split('_');
                        ext = ext[1];   // exten
                        activate(ext);
                    });

                    $('.toDeactivate').on('click', function(e){
                        ext = this.id.split('_');
                        ext = ext[1];   // exten
                        deactivate(ext);
                    });
                }

            }); //.api();

What am I doing wrong?

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    $('#contactList')

    and

    table: "#contactlist",

    There is a difference in the capitalisation of the L.

    Allan

  • cuscocusco Posts: 4Questions: 1Answers: 0

    Thank you so much Allan

    I did look at that but I overlooked it it seems, I tried to check it was the same table name etc.

    I feel dumb now.

    Thank you!

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    No worries - a second pair of eyes can often help :smile:

    Allan

  • cuscocusco Posts: 4Questions: 1Answers: 0

    I probably should start a new question, but not sure if I can ask here, because I'm following the same code.

    I am using tabletools plugin to export csv, xls etc. So I already have a few buttons and a swf that does this.

    However adding buttons for editor (create, edit, remove) does nothing

    I added:

            "select"        : true,
            "buttons"       : [
                                { extend: "create", editor: editor },
                                { extend: "edit",   editor: editor },
                                { extend: "remove", editor: editor }
            ],
    

    to the oTable dataTable({options})

    What would I need to make the editor buttons show?

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    Use the dom option to include the B option to tell DataTables where to put the buttons.

    Allan

This discussion has been closed.