Ajax Edit and Delete work, but not reflected in UI

Ajax Edit and Delete work, but not reflected in UI

1ticket1ticket Posts: 11Questions: 8Answers: 1

So my table is correctly modifying items in the database, but as soon as I press enter during inline editing, the change isn't reflected in the table in the UI. Also adding rows doesn't add the item to the UI either, but shows up in the database.

    Window.credsManager.editor = editor = new $.fn.dataTable.Editor({
        dom: "Bfrtip",
        idSrc:  'internal_id',
        ajax: {
            create: {
                type: 'POST',
                url: _config.apis.dti1ticketapps.credentialsUrl,
                contentType: 'application/json',
                headers: { 'x-api-key': _config.apis.dti1ticketapps.devtoken},
                data: function (d) {
                    d = JSON.parse(JSON.stringify(d))
                    let { internal_id, ...payload} = d.data[0]
                    return JSON.stringify(payload);
                },
            },
            edit: {
                type: 'PUT',
                url: _config.apis.dti1ticketapps.credentialsUrl,
                headers: { 'x-api-key': _config.apis.dti1ticketapps.devtoken},
                contentType: 'application/json',
                data: function (d) {
                    return JSON.stringify({rows:d.data})
                },
            },
            remove: {
                type: 'DELETE',
                url: _config.apis.dti1ticketapps.credentialsUrl,
                headers: { 'x-api-key': _config.apis.dti1ticketapps.devtoken},
                contentType: 'application/json',
                deleteBody: false,
                data: function (d) {
                    d = JSON.parse(JSON.stringify(d))
                    let { internal_id, ...payload} = d.data
                    ids = {ids:Object.keys(payload)}
                    return JSON.stringify(ids);
                },
            },
        },

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.