Usage
Typescript Import Format
//To use this interface, import as below.
import {IndexerModel} from "ojs/ojindexer";
For additional information visit:
The interface for oj.IndexerModel which should be implemented by all object instances
bound to the data parameter for ojIndexer.
Fields
-
(static) SECTION_OTHERS :Object
-
Constant for the section that represents all non-letters including numbers and symbols.
Properties:
Name Type Description id
string The id of this section label
string The label of this section
Methods
-
getIndexableSections(): IndexerModel.Section[]
-
Returns an array of objects each representing a section in the associated ListView. The section object could either be a String or an object containing at least a 'label' field. For example, the implementation may return an array of Strings representing letters of the alphabet. Or it may return an array of objects each containing a 'label' field for the section titles.
Returns:
an array of all indexable sections
- Type
- Array.<string> | Array.<Object>
-
getMissingSections(): IndexerModel.Section[]
-
Returns an array of objects each representing a section that does not have a corresponding section in the associated ListView. It must be a subset of the return value of
getIndexableSections
. Return null or undefined if there's nothing missing.Returns:
an array of missing sections
- Type
- Array.<string> | Array.<Object>
-
setSection(section: IndexerModel.Section): Promise<oj.IndexerModel.Section>
-
Make a section current in the Indexer. The implementation should scroll the associated ListView so that the section becomes visible.
Parameters:
Name Type Description section
string | Object the current section Returns:
a Promise which when resolved will return the section that the associated ListView actually scrolls to. For example, the implementation could choose to scroll to the next available section in ListView if no data exists for that section.
- Type
- Promise.<string> | Promise.<Object>