Uncaught TypeError: Cannot read property 'oFeatures' of undefined in editor with left join

Uncaught TypeError: Cannot read property 'oFeatures' of undefined in editor with left join

Dika93Dika93 Posts: 3Questions: 2Answers: 0
edited September 2017 in Free community support

My js is like this

$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        "ajax": "datasoal.php",
        "table": "#tabel1",
        "fields": [ 
            {
                "label":"Nomor",
                "name": "alat_tes.no"
            }, {
                "label":"Kategori soal:",
                "name": "kategori.nama_kategori"
            }, {
                "label":"Jenis",
                "name": "alat_tes.jenis"
            }, {
                "label":"Soal :",
                "name": "alat_tes.soal"
            }, {
                "label":"Penjelasan :",
                "name": "alat_tes.penjelasan"
            }
        ]
    } );

My server side script

<?php
 
/*
 * Example PHP implementation used for the index.html example
 */
 
// DataTables PHP library
include( "php/DataTables.php" );
 
// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;
 
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'alat_tes' )
    ->fields(
        Field::inst( 'alat_tes.no' ),
        Field::inst( 'kategori.nama_kategori' ),
        Field::inst( 'alat_tes.jenis' ),
        Field::inst( 'alat_tes.soal' ),
        Field::inst( 'alat_tes.penjelasan' )
    )
    ->leftJoin( 'kategori_soal as kategori',   'kategori.id_kategori',   '=', 'alat_tes.id_kategori' )
    ->process( $_POST )
    ->json();

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

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Can you show me your DataTables initialisation as well please?

    Thanks,
    Allan

  • Dika93Dika93 Posts: 3Questions: 2Answers: 0
    edited September 2017
      $('#tabel1').DataTable( {
            scrollX: true,
            pagingType: "numbers",
            processing:true,
            ajax: "datasoal.php",
            columns: [
                { data: "alat_tes.no" },
                { data: "kategori.nama_kategori" },
                { data: "alat_tes.jenis" },
                { data: "alat_tes.soal" },
                { data: "alat_tes.penjelasan"},
                {
                    data: null,
                    className: "center",
                    defaultContent: '<a href="" class="editor_edit btn btn-xs btn-warning"><span class="glyphicon glyphicon-pencil"></span></a> &nbsp; <a href="" class="editor_remove btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span></a>'
                }
            ]
        } );
    

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

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    I'm afraid I don't actually see what would be causing the issue there I'm afraid - that code looks okay. Can you link to the page showing the issue so I can attempt to debug it?

    Thanks,
    Allan

This discussion has been closed.