Skip to main content

# IStyling

Interface for managing dynamic styling of fields and table rows Allows conditional styling based on field values and criteria

## Extends​

- `IScriptingObject`

## Methods​

### _dispose()?​

    optional _dispose(): void;

#### Returns​

`void`

#### Inherited from​

`IScriptingObject`.`_dispose`

### _toJSON()​

    _toJSON(): RemotingScriptingObject;

#### Returns​

`RemotingScriptingObject`

#### Inherited from​

`IScriptingObject`.`_toJSON`

### getAllFieldStyles()​

    getAllFieldStyles(): Promise<
      | StyleOptions & {
      fieldId: string;
    }[]
    | undefined>;

Get style configurations for all fields that have custom styles applied

#### Returns​

`Promise`< | `StyleOptions` & { `fieldId`: `string`; }[] | `undefined`>

Promise resolving to array of field styles with their IDs, or undefined if no fields have custom styles

#### Example​

    const allStyles = await styling.getAllFieldStyles();
    if (allStyles) {
      allStyles.forEach(style => {
        console.log(`Field ${style.fieldId} has color ${style.color}`);
      });
    }

### getAllTableRowStyles()​

    getAllTableRowStyles(): Promise<
      | TableRowStyleOptions & {
      tableId: string;
    }[]
    | undefined>;

Get style configurations for all tables that have row-level conditional styling

#### Returns​

`Promise`< | `TableRowStyleOptions` & { `tableId`: `string`; }[] | `undefined`>

Promise resolving to array of table row styles with their table IDs, or undefined if no tables have custom row styles

#### Example​

    const allRowStyles = await styling.getAllTableRowStyles();
    if (allRowStyles) {
      allRowStyles.forEach(rowStyle => {
        console.log(`Table ${rowStyle.tableId} has ${Object.keys(rowStyle.criteria).length} criteria`);
      });
    }

### getFieldStyle()​

    getFieldStyle(fieldId: string): Promise<StyleOptions | undefined>;

Get style configuration for a specific field

#### Parameters​

##### fieldId​

`string`

Field identifier to retrieve styles for

#### Returns​

`Promise`<`StyleOptions` | `undefined`>

Promise resolving to field style configuration or undefined if not found

#### Example​

    const style = await styling.getFieldStyle('field1');
    if (style) {
      console.log('Field color:', style.color);
    }

### getTableRowStyle()​

    getTableRowStyle(tableId: string): Promise<
      | TableRowStyleOptions[]
    | undefined>;

Get conditional row style configuration for a specific table

#### Parameters​

##### tableId​

`string`

Unique identifier for the table (case-sensitive, URN format recommended)

#### Returns​

`Promise`< | `TableRowStyleOptions`[] | `undefined`>

Promise resolving to table row styles configuration with criteria and styles, or undefined if no custom row styles are configured for this table

#### Example​

    const rowStyles = await styling.getTableRowStyle('urn:loan:pipeline');
    if (rowStyles && rowStyles.length > 0) {
      console.log('Row criteria:', rowStyles[0].criteria);
      console.log('Styles to apply:', rowStyles[0].styles);
    }

### setFieldStyle()​

    setFieldStyle(fieldId: string, options: StyleOptions): Promise<void>;

Set or update style configuration for a specific field

#### Parameters​

##### fieldId​

`string`

Unique identifier for the field to style

##### options​

`StyleOptions`

Style properties to apply (color, borderColor, backgroundColor)

#### Returns​

`Promise`<`void`>

Promise that resolves when styles have been successfully applied

#### Example​

    // Apply multiple style properties to a field
    await styling.setFieldStyle('loanAmount', {
      color: 'red',
      backgroundColor: '#ffe0e0',
      borderColor: '#ff0000'
    });

### setTableRowStyle()​

    setTableRowStyle(tableId: string, options: TableRowStyleOptions[]): Promise<void>;

Set or update conditional styling rules for table rows Multiple style rules can be defined, each with different criteria. Rows matching any rule's criteria will have those styles applied

#### Parameters​

##### tableId​

`string`

Unique identifier for the table (case-sensitive, URN format recommended, e.g., 'urn:loan:pipeline')

##### options​

`TableRowStyleOptions`[]

Array of style configurations, each with criteria that determine when to apply the styles

#### Returns​

`Promise`<`void`>

Promise that resolves when style rules have been successfully configured

#### Example​

    // Apply different styles based on multiple conditions
    await styling.setTableRowStyle('urn:loan:pipeline', [
      {
        // Highlight high-value loans in red
        criteria: { amount: { gt: 1000000 } },
        styles: { color: 'red', backgroundColor: '#ffe0e0' }
      },
      {
        // Highlight urgent items with red border
        criteria: { priority: { in: ['urgent', 'critical'] } },
        styles: { borderColor: 'red' }
      },
      {
        // Highlight active items with green background
        criteria: { status: { eq: 'active' } },
        styles: { backgroundColor: '#e0ffe0' }
      }
    ]);

## Properties​

### id​

    readonly id: string;

#### Inherited from​

`IScriptingObject`.`id`

### objectType​

    readonly objectType: string;

#### Inherited from​

`IScriptingObject`.`objectType`