base_component
django_spire.core.components.scroll.base_component
SCROLL_TEMPLATES = frozenset({'django_spire/component/scroll/scroll.html'})
module-attribute
ITEM_TEMPLATES = frozenset({'django_spire/component/scroll/item/item.html', 'django_spire/component/scroll/item/table_item.html'})
module-attribute
BATCH_TEMPLATE = 'django_spire/component/scroll/scroll_batch.html'
module-attribute
ScrollBatch
dataclass
items
instance-attribute
keys
instance-attribute
has_more
instance-attribute
rows
property
BaseScrollComponent
Bases: Component, ABC
An infinite list of any kind of item.
Subclasses supply the items through get_items(), get_item() and
get_item_key(); this base owns paging and every client behaviour.
The server keeps no position: the client sends the number of items it
holds, and a render always shows the first batch.
item_template is the markup for one item. Each item is rendered on
the server, so the template must extend the scroll's item/item.html
or item/table_item.html.
A callable that changes an item fires item_added, item_changed or
item_removed with key=, and the list updates that one row.
Served by as_view(), the list fills spire's full page.
template = 'django_spire/component/scroll/scroll.html'
class-attribute
instance-attribute
view_template = 'django_spire/component/page/full_page.html'
class-attribute
instance-attribute
item_template = None
class-attribute
batch_size = 25
class-attribute
item_added = Glue.event()
class-attribute
instance-attribute
item_changed = Glue.event()
class-attribute
instance-attribute
item_removed = Glue.event()
class-attribute
instance-attribute
renders_items_on_server
property
first_batch
cached
property
get_items
abstractmethod
Return up to limit items starting at offset, in an order that
is the same on every call.
get_item
abstractmethod
Return the item with this key, or None when it no longer belongs in the list.
get_item_key
abstractmethod
introduce
Check, once per class, that its templates extend the scroll's own.