core_grades/searchwidget/basewidget

Description:
  • A widget to search users or grade items within the gradebook.

Source:
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

A widget to search users or grade items within the gradebook.

Methods

(inner) debounceCallee(searchValue, data, searchFunction) → {Array}

Description:
  • We have a small helper that'll call the curried search function allowing callers to filter the data set however we want rather than defining how data must be filtered.

Source:
Parameters:
Name Type Description
searchValue String

The input from the user that we'll search against.

data Array

An array of all the data generated by the callee.

searchFunction function

Partially applied function we need to manage search the passed dataset.

Returns:

The filtered subset of the provided data that we'll then render into the results.

Type
Array

(inner) init(widgetContentContainer, bodyPromise, data, searchFunc, unsearchableContent, afterSelect)

Description:
  • Build the base searching widget.

Source:
Parameters:
Name Type Description
widgetContentContainer HTMLElement

The selector for the widget container element.

bodyPromise Promise

The promise from the callee of the contents to place in the widget container.

data Array

An array of all the data generated by the callee.

searchFunc function

Partially applied function we need to manage search the passed dataset.

unsearchableContent string | null

The content rendered in a non-searchable area.

afterSelect function | null

Callback executed after an item is selected.

(inner) promisesAndResolvers() → {Object}

Description:
  • We want to create the basic promises and hooks that the caller will implement, so we can build the search widget ahead of time and allow the caller to resolve their promises once complete.

Source:
Returns:
Type
Object

(inner) registerListenerEvents(widgetContentContainer, data, searchFunc, afterSelect)

Description:
  • Register the event listeners for the search widget.

Source:
Parameters:
Name Type Description
widgetContentContainer HTMLElement

The selector for the widget container element.

data Array

An array of all the data generated by the callee.

searchFunc function

Partially applied function we need to manage search the passed dataset.

afterSelect function | null

Callback executed after an item is selected.

(inner) renderSearchResults(searchResultsContainer, searchResultsData)

Description:
  • Given the output of the callers' search function, render out the results into the search results container.

Source:
Parameters:
Name Type Description
searchResultsContainer HTMLElement

The DOM node of the widget where we'll render the provided results.

searchResultsData Array

The filtered subset of the provided data that we'll then render into the results.

(inner) showLoader(container)

Description:
  • Renders the loading placeholder for the search widget.

Source:
Parameters:
Name Type Description
container HTMLElement

The DOM node where we'll render the loading placeholder.