Skip to content
Eric edited this page Feb 2, 2024 · 14 revisions

Table is a sortable table that renders content raw, or render its type instead if content is not string or number. It utilizes DynamicList to render the inner list and Templater to render the rows.

Consider the following array

 [
      {"name" : "Eric", "bio" : "<p>some html</p>", "age": 30, "colors": ["red" "yellow"], "address" : {"street" ...}}, 
      {...}
 ]

the first row will be rendered as (skipping the HTML rendering and object/array)

 "Eric", "</>", "30", "[...]", "{...}"

OML

 {"selector:Table": {CONFIG}}

Config

 {
      "max_rows" : 30,  //max number of rows to display per page
      "prop_search" : 10,  //number of objects cycled to gather properties
      "key" : "_id", //a unique key shared by each record          
      "list" : [],
      "mode" : "row|item", //optional, see mode
      "mapping" : false //optional, see mapping
 }

Mode

Table has 2 selection mode, either the whole record using row, of a property/value combo using item

Mapping

You can map your fields to display them with a different label and in a desired order

 {
      ...,
      "mapping" : {
            "some_property" : {"label" : "Some Property", "index" : 1},
            "other_property" : {"label" : "Other Property", "index" : 0}
       }
  }

Methods

val

set list

 my_table.val([...]);

get list

 my_table.val();

page

get current page

 my_table.page();
Clone this wiki locally