configureAsTableElements

Type: Function

How to get configureAsTableElements?

JavaScript

import configureAsTableElements from 'fontoxml-table-flow/src/configureAsTableElements.js'

Configures the elements used in a table. This function is limited to configuring only those elements that define the tables structure. Any elements like XHTML caption and TEI head need to be configured separately.

Cells will be configured as Frame when their default text container is set. Else, cells will be configured as FrameWithBlock.

The cell element menu button widgets are added based on the existence of contextual operations on cell level. Make sure that only cell-specific operations are added to the cell widget, so that users are only given options relevant to them. Example on how you can add this element menu on the widget:

Other

   configureProperties(sxModule, 'self::cell', {
	contextualOperations: [
		{ name: 'contextual-set-total-cell', hideIn: ['context-menu'] }
	]
});

Check our guide for more information on table widgets. Example usage for the table widgets:

Other

   configureAsTableElements(
       sxModule,
       {
		table: {
			localName: 'table'
		},
		cell: {
			defaultTextContainer: 'p'
		},
		columnBefore: [
			createIconWidget('clock-o', {
				clickOperation: 'lcTime-value-edit',
				tooltipContent: 'Click here to edit the duration'
			})
		],
		rowBefore: [
			createIconWidget('dot-circle-o', {
				clickOperation: 'do-nothing'
			})
		],
		showInsertionWidget: true,
		showSelectionWidget: true,
		isCollapsibleQuery: 'false()',
		isInitiallyCollapsedQuery: 'true()',
		columnWidgetMenuOperations: [{ name: 'column-delete-at-index' }],
		rowWidgetMenuOperations:[
			{ contents: [{ name: 'do-nothing' }] },
			{
				contents: [
 					{ name: 'contextual-row-insert' },
					{ name: 'contextual-row-after-insert' }
				]
			},
			{ contents: [{ name: 'contextual-row-delete' }]	}
		]
	},
       tableDefinition
   );

Tables can also be configured to be collapsible. Refer to our guide to learn more.

Arguments

  1. sxModule

    (Required)

    Type: SxModule

    The sxModule to use for configuring the elements.

  2. options

    (Required)

    Type: Object

    Configuration options.

    Properties

  3. tableDefinition

    (Required)

    The table definition to use.