fieldConf is undefined

fieldConf is undefined

komserbeykomserbey Posts: 25Questions: 0Answers: 0
edited August 2013 in Editor
Hello,

I got the following error in my console:

[code]
dataTables.editor.js (line 1668)
TypeError: fieldConf is undefined
var fieldType = Editor.fieldTypes[ fieldConf.type ];
[/code]

Its on one page. other pages have no errors.

Regards,

K

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Can you show us your configuration for how you initialise Editor? It probably means that there is a typo in the `type` option for the field.

    Allan
  • komserbeykomserbey Posts: 25Questions: 0Answers: 0
    edited August 2013
    Hello,

    This is the code for the Editor:

    [code]
    var editorMaterial;

    // Configure the envelope display to attach to the header and not scroll the window
    var envelopeConf = $.fn.dataTable.Editor.display.envelope.conf;
    envelopeConf.attach = 'head';
    envelopeConf.windowScroll = false;

    editorMaterial = new $.fn.dataTable.Editor( {
    "ajaxUrl": "JsonTest.php?matid=<?php echo $_GET['mat_id']; ?>",
    "domTable": "#tableMaterial",
    "fields": [ {
    "type": "hidden",
    "name": "matid",
    "default": "<?php echo $_GET['mat_id']; ?>"
    }, {
    "type": "date",
    "dateFormat": "dd-mm-yy",
    "label": "Datum:",
    "name": "maintenance_date",
    "dateImage": "datatables/extras/Editor/media/images/calender.png"
    }, {
    "label": "Draaiuren:",
    "name": "operating_hours"
    }, {
    "type": "select",
    "label": "Soort onderhoud:",
    "name": "type",
    "ipOpts": [
    { "label": "Keuring", "value": "Keuring" },
    { "label": "Reparatie", "value": "Reparatie" }
    ]
    }
    ],
    "i18n": {
    "create": {
    "button": "Nieuw",
    "title": "Nieuwe onderhoud aanmaken",
    "submit": "Aanmaken"
    },
    "edit": {
    "button": "Wijzigen",
    "title": "Onderhoud wijzigen",
    "submit": "Wijzigen"
    },
    "remove": {
    "button": "Verwijderen",
    "title": "Onderhoud verwijderen",
    "submit": "Verwijderen",
    "confirm": {
    "_": "Weet u zeker dat u de geselecteerde materialen wilt verwijderen?", // use %d for num of rows
    "1": "Weet u zeker dat u de geselecteerde materiaal wilt verwijderen?"
    }
    },
    "error": {
    "system": "Er is een fout opgetreden, neem contact op met uw contactpersoon."
    }
    }
    } );
    [/code]

    Thank you!
  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Thanks for that. I read the error incorrectly before! Sorry about that! Its not that the type doesn't exist, but that a field doesn't exist.

    Are you using the Editor API anywhere? It looks like there might be a field name reference which is wrong.

    Thanks,
    Allan
  • komserbeykomserbey Posts: 25Questions: 0Answers: 0
    Holy shit, I add this in the dataTable() section:

    [code]
    "fnInitComplete": function ( settings, json ) {
    // Set the allowed values for the select and radio fields based on
    // what is available in the database
    editorMaterial.field('view_all_relation_view.id').update( json.view_all_relation_view );
    }
    [/code]

    But forgot to add this in the Editor() section:

    [code]
    {
    "label": "Opdrachtgever:",
    "name": "view_all_relation_view.id",
    "type": "select"
    }
    [/code]

    Its working now. Thank you for the fast reply. I really appreciate your help!
  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Heh - no problem. Good to hear its working now :-)

    Allan
This discussion has been closed.