core_grades/searchwidget/basewidget

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

Methods

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

Source:

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.

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)

Source:

Build the base searching widget.

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}

Source:

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.

Returns:
Type
Object

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

Source:

Register the event listeners for the search widget.

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)

Source:

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

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)

Source:

Renders the loading placeholder for the search widget.

Parameters:
Name Type Description
container HTMLElement

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