gridPage

A library grid page as LoadItemsTask2 assembles it from the server's replies.

In source/ rather than in the Task so a Rooibos suite can reach it: a Task's functions are scoped to its component. Same move as gridQuery.bs.

Methods

(static) appendSecondRange(data, second, isCounted) → {void}

Adds the second request's reply to the first's. On the first page the total is the two ranges' counts together; on a later page neither counted, and the total is left as it is.

The caller makes both requests and decides what a failure means: this only combines two replies that both arrived.

Parameters:
NameTypeDescription
dataobject

the first request's reply ({ Items, TotalRecordCount }); modified in place

secondobject

the second request's reply

isCountedboolean

whether both requests counted (the first page)

Returns:
Type: 
void

(static) genreSampleFields(isMusic) → {string}

The Fields a Genres view asks for on each genre's sample items: the poster and backdrop data and the sync flag, plus MediaSourceCount unless the samples are music.

See itemFields for why music leaves MediaSourceCount out.

Parameters:
NameTypeDescription
isMusicboolean

true when the samples are music items (the music library's Genres view)

Returns:

the comma-separated Fields string

Type: 
string

(static) hashFirstRequest(startIndex, limit, firstRangeTotal) → {object}

The first request for one page of "#": which range, from where, for how many, and whether the server counts it.

The first page counts, and starts at the top of the first range. A later page knows the first range's size from that count, which is how it finds its place in the two ranges.

Parameters:
NameTypeDescription
startIndexinteger

the page's first item, counted across both ranges

limitinteger

the page size

firstRangeTotalinteger

the first range's count from the first page; -1 on the first page

Returns:

an AA of range (an index into hashRanges()), startIndex, limit and counts

Type: 
object

(static) hashRanges() → {object}

The "#" letter filter: every name that starts with no letter A–Z. The server offers no "not a letter" filter, so "#" is two ranges of the sort name, asked for one after the other: before "a", and from "{" on ("{" is the character after "z"). Between them they hold every item no letter holds, each once, so the server counts both exactly and nothing is filtered here.

Verified 2026-09-25 against 10.7.7, 10.8.13, 10.9.11, 10.10.7, 10.11.11 and 12.0.0: A–Z plus these two ranges put every item of a library in exactly one place, for /Items and /Genres (/Artists and /Studios share the /Genres filter code). 10.11.0–10.11.2 compared only first characters and matched on Name as well, so there some items fall in no range or in two whatever this sends; 10.11.3 fixed it (jellyfin#15381). See jellyfin-server-versioning.md.

Returns:
Type: 
object

(static) hashRequestParams(params, request) → {object}

The query params for one "#" request: the page's params with this request's range, start, size and whether to count. A copy: params stays the page's.

Parameters:
NameTypeDescription
paramsobject

the page's query params, without a name filter

requestobject

from hashFirstRequest() or hashSecondRequest()

Returns:
Type: 
object

(static) hashSecondRequest(first, delivered, limit) → {dynamic}

The request that completes the page after the first delivered delivered items, or invalid when the page needs none.

Once the first range has run out (it delivered fewer than asked for), the rest of the page comes from the top of the second. The first page always asks the second range, even when the first range filled the page (limit 0: the count alone), because the grid's total is both counts.

Parameters:
NameTypeDescription
firstobject

from hashFirstRequest()

deliveredinteger

how many items the first request delivered

limitinteger

the page size

Returns:
Type: 
dynamic

(static) itemFields(itemType, additionalFields) → {string}

The Fields a grid query asks for: Overview, MediaSourceCount for every type except music, then the caller's extras.

MediaSourceCount is what tells a video tile it has alternate versions. Jellyfin fills it only for videos (DtoService, 10.7.7 through 12.x), so the music grid queries leave it out.

Parameters:
NameTypeDescription
itemTypestring

the grid's item type, such as "Movie" or "MusicAlbum"

additionalFieldsstring

extra comma-separated fields to append, or ""

Returns:

the comma-separated Fields string

Type: 
string