Use dataset instead of ajax in Editor

Use dataset instead of ajax in Editor

ral001ral001 Posts: 1Questions: 1Answers: 0
edited January 2016 in Free community support

I wanted to use DATA instead of AJAX (ajax works connecting to mysql).

I'm getting error message "DataTables warning: table id=example1 - Requested unknown parameter 'first_name' for row 0, column 1."

Thanks.

=================================

<script>
var dataSet1 = [
      {
        "first_name": "test1",
      }
];
</script>

=================================

    $('#example1').DataTable( {
        dom: "Bfrtip",
        //ajax: "../php/staff.php",
        data: "dataSet1",
        table: "#example1",     
        columns: [
            {
                data: null,
                defaultContent: '',
                className: 'select-checkbox',
                orderable: false
            },
            { data: "first_name" },
            { data: "last_name" },
            { data: "position" },
            { data: "office" },
            { data: "start_date" },
            { data: "salary", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: {
            style:    'os',
            selector: 'td:first-child'
        },
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        ]
    } );
This discussion has been closed.