detachItem - Methods - Grading API

Grading API Methods

detachItem()

Detach an attached learner Item with the responses from a grading session.

You would use this method to detach or remove an attached Item that might not need to be graded.

Important The Item to be detached should match from the attached Item's reference in the current grading session.

Important The wrapper element of the detached Item will persist in the DOM and should be explicitly removed.

Examples

// Example of detaching an Item from a grading session
const payload = {
    sessionId: 'session-uuid',
    userId:   'user-id',
    item: 'item-reference'
};

// Using a async and await function to detach the Item and return the session object
const attachedItems = await gradingApp.detachItem(payload);

// Or using a promise function to dettach the Item and return the session object
gradingApp.detachItem(payload)
.then((sessions) => {
    console.log(sessions);
})
.catch((error) => {
    console.error(error);
});

Arguments

  • options object

    • items string|object

      The string reference or object should match from the attached Items of the current grading session.

    • sessionId string

      The matching session ID of the attached Item.

    • user string

      The matching user ID of the attached Item.

Return value

Type Promise | object

When the promise resolves, it will return the payload of the detached Item with the wrapper element.

  • item string

    The detached Item reference.

  • sessionId string

    The session ID of the detached Item.

  • userId string

    The user ID of the detached Item.

  • element object | DOM element

    The DOM element where the Item was attached.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.