Domanda

I'm using the following code to test removing an element from a Shaerpoint list using jQuery

$('#RequestList').on('click', '.removeFirst', function (e) {
    e.preventDefault();
    $().SPServices({
        operation: "UpdateListItems",
        listName: 'ScheduleRequests',
        batchCmd: "Delete",
        ID: 0,
        completefunc: function (xData, Status) {
            alert("Item ID 0 has been removed");
        }
    });
});

completefunc is being run as if the removal succeeded, however the list element isn't actually being removed from the list. I believe this error is syntax related, I'm new to SPServices so I'm not certain on the syntax. Any Ideas on how to make the function remove the first list element?

È stato utile?

Soluzione

The ID is the ID automatically generated by Sharepoint. It starts at 1. For each item created into a list you have this unique ID. It's this one you need to use.

You may also want to check my API library I did to deal with Sharepoint. I think it's more intuitive than SPServices... : http://aymkdn.github.io/SharepointPlus/symbols/%24SP%28%29.list.html#.remove

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top