Paginate very large list

In my view template, I have the following code:

<div style="column-count: 4; line-height: 2;">
  <$list filter="[get[author]enlist-input[]unique[]sort[]]" variable="rwords">
  ...
  </$list>
</div>

This produces a nice four column list. The only problem is that it is too long. That means scrolling like mad. Is there a way I can paginate the list? So, all authors with names starting with A appear on their own page and if there are more than a specific number of these, say, 20 or 50, the list is further paginated.

Here’s one way to filter a portion of a list (tiddlers tagged with table in this example) using the first and last filter operator:

* Start = <$edit-text field="start"  inputActions="""
<$action-listops $field="end" $filter="[<currentTiddler>] +[{!!start}add{!!range}]"/>
"""/>
* Range = <$edit-text field="range" inputActions="""
<$action-listops $field="end" $filter="[<currentTiddler>] +[{!!start}add{!!range}]"/>
"""/>
* End= <$edit-text field="end"  inputActions="""
<$action-listops $field="range" $filter="[<currentTiddler>] +[{!!end}subtract{!!start}]"/>
"""/>

<$let
last={{{ [tag[table]first{!!end}count[]subtract{!!start}add[1]] :filter[compare:number:gt[0]] ~[[0]]  }}}
>
<$list filter="[tag[table]first{!!end}last<last>]">
<$link/>
</$list>

</$let>

first select the first nth results, then last keep the last nth results.

Instead of using edit-text widgets you could use buttons for your pagination.

1 Like

Is the problem that there are so many names “in total” that there is a lot of scrolling or is it potentially that any letter, say letter M, can also have so many names that it causes a problem?

If it is only the former then I have a pretty cool solution… that you might not like. I first need to build it tho :wink:

1 Like

You can make use of CSS overflow if you are happy to scroll the list separately but if the data is suitable for indexes you can create one at the top and only ever display a subset;

The above could list with [prefix[a]]...

You could disable those buttons with no cases, even display a the count of items for each.
[prefix[a]]... + [count[]]

  • If you are going to paginate a list its smart to allow the user to choose the list size
  • only paginate when more than N items are in the list
  • Others have done the pagination for tables have a look at Mohammads tables and shiraz tools
1 Like

Referring back to this

See the alphaindex.

1 Like

@twMat Thanks. The problem presently is that there are too many entries in total. But I can clearly see that in near future, there will be too many entries in some specific letters, say M or S.

On a related note, the list consists of words in Devanagari, something like भारत, मुंबई, etc.