Cannot add field for editor

Cannot add field for editor

Boco10Boco10 Posts: 3Questions: 1Answers: 0

Hello!

This is working fine:

var editor;

$(document).ready(function() {

editor = new $.fn.dataTable.Editor( {
    ajax: "ajax/stand_status_object.php",
    table: "#example",
    fields: 
        [
        ]        
});

$('#example').dataTable( {
    dom: 'T<"clear">lfrtip',
    "processing": true,
    ajax: "ajax/stand_status_object.php",
    columns: [
        { data: null, render: function ( data, type, row ) {
            // Combine the first and last names into a single table field
            return data.first_name+' '+data.last_name;
        } },
        { data: "position" },
        { data: "office" },
        { data: "extn" },
        { data: "start_date" },
        { data: "salary" }
    ],
    tableTools: {
        sRowSelect: "os",
        sRowSelector: 'td:first-child',
        aButtons: [
            { sExtends: "editor_edit",   editor: editor },
        ]
    }
} );

} );

I can see my items loaded and shown in the table. I can see the edit button, but when i press it it's empty. Because the fields parameter is empty. But when i try to add anything like :

{
label: "First name:",
name: "first_name"
}, {
label: "Last name:",
name: "last_name"
}, {
label: "Position:",
name: "position"
}, {
label: "Office:",
name: "office"
}, {
label: "Extension:",
name: "extn"
}, {
label: "Start date:",
name: "start_date",
type: "date"
}, {
label: "Salary:",
name: "salary"
}

Then the table is no longer load. Any idea? Thanks in advance.

Answers

  • allanallan Posts: 63,695Questions: 1Answers: 10,500 Site admin

    Then the table is no longer load.

    Sounds like a Javascript error is occurring. If you look at the console in your browser when that happens, are there any errors reported?

    Allan

  • Boco10Boco10 Posts: 3Questions: 1Answers: 0

    TypeError: g[(((((((((((q7 + a16) + L3) + J4) + X26) + G26) + G4) + L8) + X26) + N6) + A8) + e86)] is not a function
    http://xyz/js/dataTables.editor.js
    Line 47

  • allanallan Posts: 63,695Questions: 1Answers: 10,500 Site admin

    Hmm - a little tricky that one :-). Are you able to link me to the page so I can take a look?

    Thanks,
    Allan

  • Boco10Boco10 Posts: 3Questions: 1Answers: 0
    edited November 2014

    You cant reach it sadly. Any tip what to try to solve it?

  • allanallan Posts: 63,695Questions: 1Answers: 10,500 Site admin

    Can you show me the exact code your are using for the Javascript on the page, and the full HTML (i.e. everything!) so I can take a look and see what might be happening.

    Thanks,
    Allan

This discussion has been closed.