Skip to main content

Layout - TableBuilder

Layout.TableBuilder

Define a UI Table from a

Stream within a LayoutBuilder.

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
date: DateTimeType,
float: FloatType,
})
)
);

// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.float("Float", fields => fields.float)
)
.toTemplate()

Layout

constructor

new TableBuilder(name, module):

TableBuilder

Define a UI Table from a

Stream within a LayoutBuilder.

Parameters

NameTypeDescription
namestringthe name for the TableBuilder
moduleModulePath-

Returns

TableBuilder

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
date: DateTimeType,
float: FloatType,
})
)
);

// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.float("Float", fields => fields.float)
)
.toTemplate()

fromPatch

fromPatch(patch):

DictStructTableFinalizer

Define the

PatchSourceBuilder to build an editable TableBuilder within a LayoutBuilder.

Type parameters

NameType
Textends DictType

Parameters

NameType
patchPatchSourceBuilder

Returns

DictStructTableFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
})
)
);

const patch = new SourceBuilder("My Patch")
.patch(products_data.outputStream())

// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromPatch(patch)
.columns()
)
.toTemplate()

fromStream

fromStream(stream): T extends

DictType ? DictStructTableFinalizer : T extends ArrayType ? ArrayTableFinalizer : T extends DictType ? PrimitiveTableFinalizer<T, Record> : never

Define the

Stream to build a TableBuilder within a LayoutBuilder.

Type parameters

NameType
Textends DictType | ArrayType

Parameters

NameTypeDescription
streamStreamthe DictType or ArrayType Stream to build the table from

Returns

T extends

DictType ? DictStructTableFinalizer : T extends ArrayType ? ArrayTableFinalizer : T extends DictType ? PrimitiveTableFinalizer<T, Record> : never

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
})
)
);

// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.columns()
)
.toTemplate()