Layout - TableBuilder
Layout.TableBuilderDefine 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
Name | Type | Description |
---|---|---|
name | string | the name for the TableBuilder |
module | ModulePath | - |
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
Name | Type |
---|---|
T | extends DictType |
Parameters
Name | Type |
---|---|
patch | PatchSourceBuilder |
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
Name | Type |
---|---|
T | extends DictType | ArrayType |
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | the 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()