Edit DataTables in SharePoint

Edit DataTables in SharePoint

SPMSPM Posts: 1Questions: 1Answers: 0

Hi, I started using DataTables with SharePoint 2013 using JQuery. Right now dataTables display the data from SharePoint list, i cannot edit them. Is there a way i can edit few fields in Datatables?

Answers

  • EFH52EFH52 Posts: 8Questions: 1Answers: 0

    I am working on an implementation of this at the moment. Some of the details have been and still are a nuisance to put together. I am using Editor with some success and a some hangups yet.
    Here is an important key to data parsing the server response after a create event:

    editor.on ('postSubmit', function(e, json, data, action, xhr){
         json.data = [json.d];          
     });
    

    I had tried to issue a return statement from this function to no avail for some number of hours. Just need to tweak the var directly. This will enable the Datatable to update the rows after the create event.

    As to the create event itself. This is what I used:

    ajax: {
                create: {
                    type: 'POST',
                    url:  '/Installations/Env/_api/web/lists/getByTitle(%27EditorTest%27)/items',
                    contentType: "application/json;odata=verbose",
                    headers: {
                        "Accept": "application/json;odata=verbose",
                        "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                        },
                    data: function (d) {      
                        d.data[0].__metadata = { "type": "SP.Data.EditorTestListItem"};
                        return JSON.stringify(d.data[0]);
                    },
                    error: function (data) {
                        console.log(data);
                    },
                },
    

    Where EditorTest is my SharePoint List I'm working with as I piece a working system all together.

    I am presently hung up on the remove event. If there is interest out there, I'll come back to this and add elements as the function grows. I am seeing a need for an iterative function to handle multiple deletes after I get the single delete to work.

  • BafianaBafiana Posts: 1Questions: 0Answers: 0

    Hello EFH52! I have your same problem, but in 2020, did you try with Editor? Do you have some recommendations to give me? Thanks in advance!

This discussion has been closed.