RealGrid2 API
Interface
ColumnStyleObject

ColumnStyleObject

One of the style models that must be returned when changing the cell style with CellStyleCallback

Signature:

export interface ColumnStyleObject

Remarks

Used in GridBase.setCellStyleCallback() or ValueColumn.styleCallback.

Example

// Apply per column
let column = gridView.columnByName('Company');
 
const f = function (grid, cell) {
      return {
          styleName: 'custom-column'
      }
}
column.styleCallback = f;
 
// Apply to each data cell
gridView.setCellStyleCallback(f);

Properties

PropertyTypeDescription
booleanFormatstringWhen the value is of type Boolean, Format
buttonCellButtonSpecifies the type of CellButton to be displayed in the cell.
buttonWidthnumberChange the width of CellButton.
cellProtectPropsCellProtectPropertiesWhen exporting to Excel, set to lock cells or hide formulas.
datetimeFormatstring

Format when the value is in date format

Refer to Custom Datetime Format

editablebooleanEditable with editor
editorCellEditor | ConfigObjectEditor
excelFormatstring

Format output when exporting Excel

Enter the format code used in Excel's 'Cell Format > Custom' as a string

Structure: [Positive];[Negative];[0];[Text]

exportStyleNamestringStyle name to be applied when exported to Excel
numberFormatstringWhen the value is in numeric format, Format
prefixstringText to be displayed in front of the value
readOnlybooleanModification possible or prohibited
rendererCellRenderer | ConfigObjectrenderer
stylePartial<CSSStyleDeclaration>Used when specifying inline-style.
styleNamestringstyle name
suffixstringText to be added to the end of the value
textstringtext to be displayed in the cell instead of data
textFormatstringWhen the value is in text format, Format

Properties Desc

booleanFormat

Formatting when the value is of type Boolean

Type - string

Remarks:

If this value is specified, it is used as a conversion format when outputting the value of a boolean field.

If not specified, the value set in the data field is used.

Separated with a colon (:) or semicolon (;), the left side is false, and the right side is true.

Example) 'Nub: Yub'


button

Specifies the type of CellButton to be displayed in the cell.

Type - CellButton


buttonWidth

Change the width of CellButton.

Type - number


cellProtectProps

When exporting to Excel, set to lock cells or hide formulas.

Type - CellProtectProperties

Remarks:

If not specified, DataColumn.cellProtectProps is applied. Use with GridExportOptions.sheetProtect.


datetimeFormat

Format when the value is in date format

See Custom Datetime Format

Type - string


editable

Can be edited with editor

Type - boolean


editor

editor

Type - CellEditor | ConfigObject


excelFormat

Format output when exporting Excel

Enter the format code used in Excel's 'Cell Formatting > Custom' as a string

Structure: [Positive];[Negative];[0];[Text]

Type - string

Remarks:

For numbers, you can specify them as follows:

  1. Thousands separator comma and decimal point excelFormat: '#,##0.00'

  2. Display negative numbers in red and zeros as hyphens (-) excelFormat: '#,##0;[Red]-#,##0;"-"'

For details, refer to number-format.com (opens in a new tab)

If not specified, DataColumn.excelFormat or the format based on dataType is applied.


exportStyleName

Style name to be applied when exported to Excel

Type - string


numberFormat

Format when the value is in numeric format

Type - string


prefix

Text to display in front of the value

Type - string


readOnly

Editable or prohibited?

Type - boolean


renderer

renderer

Type - CellRenderer | ConfigObject


style

Used when specifying inline-style.

Type - Partial<CSSStyleDeclaration>

Remarks:

Specifies properties to add to the style of td.


styleName

style name

Type - string


suffix

Text to be added to the end of the value

Type - string


text

데이터 대신 셀에 표시될 text

Type - string

Remarks:

DataColumn.lookupDisplay 또는 DataColumn.displayCallback 보다 먼저 적용된다.


textFormat

Formatting when the value is in text format

Type - string