PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/samcrew/tablesort/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
samcrew / tablesort
Files
5 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/samcrew/tablesort/v0
gno
0.9

Files (5)

  • README.mdmarkdown
  • gnomod.tomltoml
  • render.gnogno
  • tablesort.gnogno
  • tablesort_test.gnogno
README.mdPreviewRaw
# `tablesort` - Sortable markdown tables

Generate sortable markdown tables with clickable column headers. Sorting state is managed via URL query parameters.

## Usage

```go
import "gno.land/p/samcrew/tablesort/v0"

table := &tablesort.Table{
    Headings: []string{"Name", "Age", "City"},
    Rows: [][]string{
        {"Alice", "25", "New York"},
        {"Bob", "30", "London"},
        {"Charlie", "22", "Paris"},
    },
}

// Basic usage
u, _ := url.Parse("/users")
markdown := tablesort.Render(u, table, "")

// Multiple tables on same page (use prefix to avoid conflicts)
markdown1 := tablesort.Render(u, table, "table1-")
markdown2 := tablesort.Render(u, table, "table2-")
```

## On-chain Example

- [/r/gov/dao/memberstore/v0:members?filter=T1](/r/gov/dao/memberstore/v0:members?filter=T1)

## API

```go
type Table struct {
    Headings []string   // Column headers
    Rows     [][]string // Table data rows
}

// `u`: Current URL for generating sort links
// `table`: Table data structure
// `paramPrefix`: Prefix for URL params (use for multiple tables)
func Render(u *url.URL, table *Table, paramPrefix string) string
```

**URL Parameters:**
- `{prefix}sort-asc={column}`: Sort column ascending
- `{prefix}sort-desc={column}`: Sort column descending

**URL Examples:**
- `/users?sort-desc=Name` - Sort by Name descending
- `/page?users-sort-asc=Age&orders-sort-desc=Total` - Multiple tables

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.