Documentation ¶
Index ¶
- func NewDataTablesCreateOutputProcessorFunc(lookup render.TemplateLookup, templateName string, ...) glazed.CreateProcessorFunc
- func NewDataTablesHTMLTemplateCreateProcessorFunc(options ...render.HTMLTemplateOutputFormatterOption) (glazed.CreateProcessorFunc, error)
- func NewDataTablesLookupTemplate() *render.LookupTemplateFromFS
- type DataTables
- type DataTablesOutputFormatter
- type DataTablesOutputFormatterOption
- func WithAdditionalData(data map[string]interface{}) DataTablesOutputFormatterOption
- func WithAppendLinks(links ...layout.Link) DataTablesOutputFormatterOption
- func WithColumns(columns ...string) DataTablesOutputFormatterOption
- func WithCommand(cmd *cmds.CommandDescription) DataTablesOutputFormatterOption
- func WithJSRendering() DataTablesOutputFormatterOption
- func WithLayout(l *layout.Layout) DataTablesOutputFormatterOption
- func WithLinks(links ...layout.Link) DataTablesOutputFormatterOption
- func WithLongDescription(desc string) DataTablesOutputFormatterOption
- func WithPrependLinks(links ...layout.Link) DataTablesOutputFormatterOption
- func WithReplaceAdditionalData(data map[string]interface{}) DataTablesOutputFormatterOption
- func WithUseDataTables() DataTablesOutputFormatterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDataTablesCreateOutputProcessorFunc ¶
func NewDataTablesCreateOutputProcessorFunc( lookup render.TemplateLookup, templateName string, options ...DataTablesOutputFormatterOption, ) glazed.CreateProcessorFunc
NewDataTablesCreateOutputProcessorFunc creates a glazed.CreateProcessorFunc based on a TemplateLookup and a template name.
func NewDataTablesHTMLTemplateCreateProcessorFunc ¶
func NewDataTablesHTMLTemplateCreateProcessorFunc( options ...render.HTMLTemplateOutputFormatterOption, ) (glazed.CreateProcessorFunc, error)
func NewDataTablesLookupTemplate ¶
func NewDataTablesLookupTemplate() *render.LookupTemplateFromFS
Types ¶
type DataTables ¶
type DataTables struct { Command *cmds.CommandDescription // LongDescription is the HTML of the rendered markdown of the long description of the command. LongDescription string Layout *layout.Layout Links []layout.Link // Stream provides a channel where each element represents a row of the table // to be rendered, already formatted. // Per default, we will render the individual rows as HTML, but the JSRendering // flag will make this output individual entries of a JS array. // // TODO(manuel, 2023-06-04): Maybe we could make this be an iterator of rows that provide access to the individual // columns for more interesting HTML shenanigans too. JSStream <-chan template.JS HTMLStream <-chan template.HTML // Configuring the template to load the table data through javascript, and provide the data itself // as a JSON array inlined in the HTML of the page. JSRendering bool Columns []string // UseDataTables is using the datatables.net framework. // This is an opinionated way of proposing different table layouts and javascript functionality // (for now). If a user wants more advanced customization, they can use the HTMLTemplateOutputFormatter // or use this implementation for inspiration. UseDataTables bool // AdditionalData to be passed to the rendering engine AdditionalData map[string]interface{} }
DataTables describes the data passed to the template displaying the results of a glazed command. It's meant to be a more structured layer on top of the HTMLOutputTemplateFormatter that parka offers for having users provide their own template formatting.
type DataTablesOutputFormatter ¶
type DataTablesOutputFormatter struct { *render.HTMLTemplateOutputFormatter // contains filtered or unexported fields }
func NewDataTablesOutputFormatter ¶
func NewDataTablesOutputFormatter( t *template.Template, of *table.OutputFormatter, options ...DataTablesOutputFormatterOption, ) *DataTablesOutputFormatter
type DataTablesOutputFormatterOption ¶
type DataTablesOutputFormatterOption func(*DataTablesOutputFormatter)
func WithAdditionalData ¶
func WithAdditionalData(data map[string]interface{}) DataTablesOutputFormatterOption
func WithAppendLinks ¶
func WithAppendLinks(links ...layout.Link) DataTablesOutputFormatterOption
func WithColumns ¶
func WithColumns(columns ...string) DataTablesOutputFormatterOption
func WithCommand ¶
func WithCommand(cmd *cmds.CommandDescription) DataTablesOutputFormatterOption
func WithJSRendering ¶
func WithJSRendering() DataTablesOutputFormatterOption
WithJSRendering enables JS rendering for the DataTables renderer. This means that we will render the table into the toplevel element `tableData` in javascript, and not call the parent output formatter
func WithLayout ¶
func WithLayout(l *layout.Layout) DataTablesOutputFormatterOption
func WithLinks ¶
func WithLinks(links ...layout.Link) DataTablesOutputFormatterOption
func WithLongDescription ¶
func WithLongDescription(desc string) DataTablesOutputFormatterOption
func WithPrependLinks ¶
func WithPrependLinks(links ...layout.Link) DataTablesOutputFormatterOption
func WithReplaceAdditionalData ¶
func WithReplaceAdditionalData(data map[string]interface{}) DataTablesOutputFormatterOption
func WithUseDataTables ¶
func WithUseDataTables() DataTablesOutputFormatterOption
Click to show internal directories.
Click to hide internal directories.