let TableEditor = function (
    table,
    url = "",
    headers,
    idSrc,
    fields) {


    this.table = table;
    this.url = url;
    this.headers = headers;
    this.idSrc = idSrc;
    this.fields = fields;

    this.editor = null;

    this.init = function () {

        if (url == "") {
            this.editor = new $.fn.dataTable.Editor({
                table: table,
                idSrc: idSrc,
                fields: fields,
            });
        }

        else {
            this.editor = new $.fn.dataTable.Editor({
                ajax: {
                    url: url,
                    headers: headers,
                },
                table: table,
                idSrc: idSrc,
                fields: fields,
            });
        }
        
    };
}

export default TableEditor;

