목록에서 고르고 체크박스로 켜고 끄기Pick from a list, toggle with a checkbox
값을 목록에서 고르게 하거나 체크박스로 켜고 끌 수 있어요. 목록 칸은 한 번 누르면 목록이 열리고 체크박스 칸은 한 번 누르면 바로 바뀌어요. 보이는 모양(배지)과 고칠 때 모양(목록)도 따로 정할 수 있어요.Let people pick a value from a list or toggle a checkbox. One click opens the list or toggles the checkbox, and what you see (a badge) and what you edit with (a list) are set separately.
코드Code
탭을 골라 코드를 복사하세요. 위 화면은 이 코드를 그대로 실행한 결과예요.Pick a tab and copy the code. The preview above runs exactly this code.
이 화면은 새 모양 옵션을 켠 모양이에요: density: 'spacious', iconStyle: 'soft', motion: true (코드에 없으면 기본 모양으로 보여요)This preview has the new-look options on: density: 'spacious', iconStyle: 'soft', motion: true (without them in your code you get the default look)
버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<div id="app">
<div class="toolbar">
<select aria-label="보이는 모양" id="look">
<option value="badge" selected>배지</option>
<option value="text">글자</option>
</select>
<select aria-label="한 번 누르면" id="click">
<option value="single" selected>바로 반응 (기본)</option>
<option value="double">안 함 (더블클릭·키)</option>
</select>
</div>
<div id="grid" style="height: 330px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);
document.getElementById('look').addEventListener('change', (event) => actions.look(api, event.target.value));
document.getElementById('click').addEventListener('change', (event) => actions.click(api, event.target.value));const tasks = [
'로그인 화면 만들기',
'결제 연동',
'검색 속도 개선',
'알림 설정',
'관리자 권한',
'배포 점검',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['낮음', '보통', '높음'];
const rows = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
let look = 'badge';
// 목록 편집: 컬럼을 kind: 'select'로 두고 editorOptions에 고를 값을 줘요. label은 화면에 보이는 이름이에요.
// 보이는 모양과 고치는 모양은 따로예요: cellRenderer 'badge'로 배지를 그리고, 편집할 때는 같은 목록이 열려요.
const statusOptions = [
{ value: 'todo', label: '할 일' },
{ value: 'doing', label: '진행 중' },
{ value: 'review', label: '검토' },
{ value: 'done', label: '완료' },
];
const columns = () => [
{ id: 'task', title: '작업', width: 170 },
{
id: 'status',
title: '상태',
kind: 'select',
width: 120,
editable: true,
editorOptions: statusOptions,
// 글자 모드에서는 값(todo) 대신 목록의 이름(할 일)을 보여 줘요.
...(look === 'text'
? {
formatValue: (value) => statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge',
cellRendererParams: {
map: {
todo: { label: '할 일', tone: 'neutral' },
doing: { label: '진행 중', tone: 'info' },
review: { label: '검토', tone: 'warning' },
done: { label: '완료', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: '우선순위',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: '완료',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit(기본 true): 목록(select) 칸은 한 번 누르면 목록이 열리고, 체크박스 칸은 한 번 누르면 바로 켜지고 꺼져요.
// false로 두면 다른 칸처럼 더블클릭이나 키(F2·Enter·Space)로 편집을 시작해요. 글자·숫자 칸은 이 옵션과 상관없이 더블클릭이에요.
singleClickEdit: true,
};
export function setup(api, log) {
const nameOf = (id, value) => id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log({
ko: '"상태"나 "우선순위" 칸을 한 번 누르면 목록이 열리고, "완료" 칸은 한 번 누르면 바로 켜지고 꺼져요. "한 번 누르면"을 바꿔서 비교해 보세요.',
en: 'Click a "상태" (status) or "우선순위" (priority) cell once to open the list; a "완료" (done) cell toggles with one click. Change "Click to edit" and compare.',
});
return api.on('editCommitted', (e) => log({
ko: `${e.rowKey}번 줄 ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
en: `Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
}));
}
export const actions = {
// 런타임에 setOptions로 바꿀 수 있어요.
click: (api, value) => api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api, value) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>목록에서 고르고 체크박스로 켜고 끄기</title>
</head>
<body>
<div class="toolbar">
<select aria-label="보이는 모양" id="look">
<option value="badge" selected>배지</option>
<option value="text">글자</option>
</select>
<select aria-label="한 번 누르면" id="click">
<option value="single" selected>바로 반응 (기본)</option>
<option value="double">안 함 (더블클릭·키)</option>
</select>
</div>
<div id="grid" style="height: 330px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const tasks = [
'로그인 화면 만들기',
'결제 연동',
'검색 속도 개선',
'알림 설정',
'관리자 권한',
'배포 점검',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['낮음', '보통', '높음'];
const rows = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
let look = 'badge';
// 목록 편집: 컬럼을 kind: 'select'로 두고 editorOptions에 고를 값을 줘요. label은 화면에 보이는 이름이에요.
// 보이는 모양과 고치는 모양은 따로예요: cellRenderer 'badge'로 배지를 그리고, 편집할 때는 같은 목록이 열려요.
const statusOptions = [
{ value: 'todo', label: '할 일' },
{ value: 'doing', label: '진행 중' },
{ value: 'review', label: '검토' },
{ value: 'done', label: '완료' },
];
const columns = () => [
{ id: 'task', title: '작업', width: 170 },
{
id: 'status',
title: '상태',
kind: 'select',
width: 120,
editable: true,
editorOptions: statusOptions,
// 글자 모드에서는 값(todo) 대신 목록의 이름(할 일)을 보여 줘요.
...(look === 'text'
? {
formatValue: (value) => statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge',
cellRendererParams: {
map: {
todo: { label: '할 일', tone: 'neutral' },
doing: { label: '진행 중', tone: 'info' },
review: { label: '검토', tone: 'warning' },
done: { label: '완료', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: '우선순위',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: '완료',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
const options = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit(기본 true): 목록(select) 칸은 한 번 누르면 목록이 열리고, 체크박스 칸은 한 번 누르면 바로 켜지고 꺼져요.
// false로 두면 다른 칸처럼 더블클릭이나 키(F2·Enter·Space)로 편집을 시작해요. 글자·숫자 칸은 이 옵션과 상관없이 더블클릭이에요.
singleClickEdit: true,
};
function setup(api, log) {
const nameOf = (id, value) => id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log({
ko: '"상태"나 "우선순위" 칸을 한 번 누르면 목록이 열리고, "완료" 칸은 한 번 누르면 바로 켜지고 꺼져요. "한 번 누르면"을 바꿔서 비교해 보세요.',
en: 'Click a "상태" (status) or "우선순위" (priority) cell once to open the list; a "완료" (done) cell toggles with one click. Change "Click to edit" and compare.',
});
return api.on('editCommitted', (e) => log({
ko: `${e.rowKey}번 줄 ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
en: `Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
}));
}
const actions = {
// 런타임에 setOptions로 바꿀 수 있어요.
click: (api, value) => api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api, value) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};
options.ariaLabel = "목록에서 고르고 체크박스로 켜고 끄기";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
setup(api, (message) => {
const item = document.createElement('li');
item.textContent =
typeof message === 'string' ? message : navigator.language.startsWith('ko') ? message.ko : message.en;
document.getElementById('log').prepend(item);
});
document.getElementById('look').addEventListener('change', (event) => actions.look(api, event.target.value));
document.getElementById('click').addEventListener('change', (event) => actions.click(api, event.target.value));
</script>
</body>
</html>버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { useEffect } from 'react';
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, setup, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
useEffect(() => (api ? setup(api, console.log) : undefined), [api]);
return (
<>
<div className="toolbar">
<select
aria-label="보이는 모양"
disabled={!api}
onChange={(event) => api && actions.look(api, event.target.value)}
>
<option value="badge">배지</option>
<option value="text">글자</option>
</select>
<select defaultValue="badge"
aria-label="한 번 누르면"
disabled={!api}
onChange={(event) => api && actions.click(api, event.target.value)}
>
<option value="single">바로 반응 (기본)</option>
<option value="double">안 함 (더블클릭·키)</option>
</select>
</div>
<Grid style={{ height: 330 }} ref={gridRef} options={options} />
</>
);
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/react';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'로그인 화면 만들기',
'결제 연동',
'검색 속도 개선',
'알림 설정',
'관리자 권한',
'배포 점검',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['낮음', '보통', '높음'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// 목록 편집: 컬럼을 kind: 'select'로 두고 editorOptions에 고를 값을 줘요. label은 화면에 보이는 이름이에요.
// 보이는 모양과 고치는 모양은 따로예요: cellRenderer 'badge'로 배지를 그리고, 편집할 때는 같은 목록이 열려요.
const statusOptions = [
{ value: 'todo', label: '할 일' },
{ value: 'doing', label: '진행 중' },
{ value: 'review', label: '검토' },
{ value: 'done', label: '완료' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: '작업', width: 170 },
{
id: 'status',
title: '상태',
kind: 'select',
width: 120,
editable: true,
editorOptions: statusOptions,
// 글자 모드에서는 값(todo) 대신 목록의 이름(할 일)을 보여 줘요.
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: '할 일', tone: 'neutral' },
doing: { label: '진행 중', tone: 'info' },
review: { label: '검토', tone: 'warning' },
done: { label: '완료', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: '우선순위',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: '완료',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit(기본 true): 목록(select) 칸은 한 번 누르면 목록이 열리고, 체크박스 칸은 한 번 누르면 바로 켜지고 꺼져요.
// false로 두면 다른 칸처럼 더블클릭이나 키(F2·Enter·Space)로 편집을 시작해요. 글자·숫자 칸은 이 옵션과 상관없이 더블클릭이에요.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log({
ko: '"상태"나 "우선순위" 칸을 한 번 누르면 목록이 열리고, "완료" 칸은 한 번 누르면 바로 켜지고 꺼져요. "한 번 누르면"을 바꿔서 비교해 보세요.',
en: 'Click a "상태" (status) or "우선순위" (priority) cell once to open the list; a "완료" (done) cell toggles with one click. Change "Click to edit" and compare.',
});
return api.on('editCommitted', (e) =>
log({
ko: `${e.rowKey}번 줄 ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
en: `Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
}),
);
}
export const actions = {
// 런타임에 setOptions로 바꿀 수 있어요.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<script setup lang="ts">
import { onBeforeUnmount, shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, setup, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
let stop: (() => void) | undefined;
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
stop = setup(event.api, console.log);
}
onBeforeUnmount(() => stop?.());
</script>
<template>
<div class="toolbar">
<select
aria-label="보이는 모양"
:disabled="!api"
@change="api && actions.look(api, ($event.target as HTMLSelectElement).value)"
>
<option value="badge" selected>배지</option>
<option value="text">글자</option>
</select>
<select
aria-label="한 번 누르면"
:disabled="!api"
@change="api && actions.click(api, ($event.target as HTMLSelectElement).value)"
>
<option value="single" selected>바로 반응 (기본)</option>
<option value="double">안 함 (더블클릭·키)</option>
</select>
</div>
<Grid style="height: 330px" :options="options" @ready="onReady" />
</template>import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/vue';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'로그인 화면 만들기',
'결제 연동',
'검색 속도 개선',
'알림 설정',
'관리자 권한',
'배포 점검',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['낮음', '보통', '높음'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// 목록 편집: 컬럼을 kind: 'select'로 두고 editorOptions에 고를 값을 줘요. label은 화면에 보이는 이름이에요.
// 보이는 모양과 고치는 모양은 따로예요: cellRenderer 'badge'로 배지를 그리고, 편집할 때는 같은 목록이 열려요.
const statusOptions = [
{ value: 'todo', label: '할 일' },
{ value: 'doing', label: '진행 중' },
{ value: 'review', label: '검토' },
{ value: 'done', label: '완료' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: '작업', width: 170 },
{
id: 'status',
title: '상태',
kind: 'select',
width: 120,
editable: true,
editorOptions: statusOptions,
// 글자 모드에서는 값(todo) 대신 목록의 이름(할 일)을 보여 줘요.
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: '할 일', tone: 'neutral' },
doing: { label: '진행 중', tone: 'info' },
review: { label: '검토', tone: 'warning' },
done: { label: '완료', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: '우선순위',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: '완료',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit(기본 true): 목록(select) 칸은 한 번 누르면 목록이 열리고, 체크박스 칸은 한 번 누르면 바로 켜지고 꺼져요.
// false로 두면 다른 칸처럼 더블클릭이나 키(F2·Enter·Space)로 편집을 시작해요. 글자·숫자 칸은 이 옵션과 상관없이 더블클릭이에요.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log({
ko: '"상태"나 "우선순위" 칸을 한 번 누르면 목록이 열리고, "완료" 칸은 한 번 누르면 바로 켜지고 꺼져요. "한 번 누르면"을 바꿔서 비교해 보세요.',
en: 'Click a "상태" (status) or "우선순위" (priority) cell once to open the list; a "완료" (done) cell toggles with one click. Change "Click to edit" and compare.',
});
return api.on('editCommitted', (e) =>
log({
ko: `${e.rowKey}번 줄 ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
en: `Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
}),
);
}
export const actions = {
// 런타임에 setOptions로 바꿀 수 있어요.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Component, OnDestroy } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, setup, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="보이는 모양"
[disabled]="!api"
(change)="api && actions.look(api, $any($event.target).value)"
>
<option value="badge" selected>배지</option>
<option value="text">글자</option>
</select>
<select
aria-label="한 번 누르면"
[disabled]="!api"
(change)="api && actions.click(api, $any($event.target).value)"
>
<option value="single" selected>바로 반응 (기본)</option>
<option value="double">안 함 (더블클릭·키)</option>
</select>
</div>
<mx-grid style="height: 330px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent implements OnDestroy {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
private stop: (() => void) | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
this.stop = setup(this.api, console.log);
}
}
ngOnDestroy(): void {
this.stop?.();
}
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/angular';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'로그인 화면 만들기',
'결제 연동',
'검색 속도 개선',
'알림 설정',
'관리자 권한',
'배포 점검',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['낮음', '보통', '높음'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// 목록 편집: 컬럼을 kind: 'select'로 두고 editorOptions에 고를 값을 줘요. label은 화면에 보이는 이름이에요.
// 보이는 모양과 고치는 모양은 따로예요: cellRenderer 'badge'로 배지를 그리고, 편집할 때는 같은 목록이 열려요.
const statusOptions = [
{ value: 'todo', label: '할 일' },
{ value: 'doing', label: '진행 중' },
{ value: 'review', label: '검토' },
{ value: 'done', label: '완료' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: '작업', width: 170 },
{
id: 'status',
title: '상태',
kind: 'select',
width: 120,
editable: true,
editorOptions: statusOptions,
// 글자 모드에서는 값(todo) 대신 목록의 이름(할 일)을 보여 줘요.
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: '할 일', tone: 'neutral' },
doing: { label: '진행 중', tone: 'info' },
review: { label: '검토', tone: 'warning' },
done: { label: '완료', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: '우선순위',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: '완료',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit(기본 true): 목록(select) 칸은 한 번 누르면 목록이 열리고, 체크박스 칸은 한 번 누르면 바로 켜지고 꺼져요.
// false로 두면 다른 칸처럼 더블클릭이나 키(F2·Enter·Space)로 편집을 시작해요. 글자·숫자 칸은 이 옵션과 상관없이 더블클릭이에요.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log({
ko: '"상태"나 "우선순위" 칸을 한 번 누르면 목록이 열리고, "완료" 칸은 한 번 누르면 바로 켜지고 꺼져요. "한 번 누르면"을 바꿔서 비교해 보세요.',
en: 'Click a "상태" (status) or "우선순위" (priority) cell once to open the list; a "완료" (done) cell toggles with one click. Change "Click to edit" and compare.',
});
return api.on('editCommitted', (e) =>
log({
ko: `${e.rowKey}번 줄 ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
en: `Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
}),
);
}
export const actions = {
// 런타임에 setOptions로 바꿀 수 있어요.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<div id="app">
<div class="toolbar">
<select aria-label="Look" id="look">
<option value="badge" selected>Badge</option>
<option value="text">Text</option>
</select>
<select aria-label="Single click" id="click">
<option value="single" selected>React at once (default)</option>
<option value="double">Off (double-click or keys)</option>
</select>
</div>
<div id="grid" style="height: 330px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);
document.getElementById('look').addEventListener('change', (event) => actions.look(api, event.target.value));
document.getElementById('click').addEventListener('change', (event) => actions.click(api, event.target.value));const tasks = [
'Build login screen',
'Payment integration',
'Speed up search',
'Notification settings',
'Admin permissions',
'Deployment check',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['Low', 'Medium', 'High'];
const rows = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
let look = 'badge';
// List editing: set the column to kind: 'select' and give the values to pick in editorOptions. label is the name shown on screen.
// What you see and what you edit with are separate: cellRenderer 'badge' draws a badge, and the same list opens when editing.
const statusOptions = [
{ value: 'todo', label: 'To do' },
{ value: 'doing', label: 'In progress' },
{ value: 'review', label: 'Review' },
{ value: 'done', label: 'Done' },
];
const columns = () => [
{ id: 'task', title: 'Task', width: 190 },
{
id: 'status',
title: 'Status',
kind: 'select',
width: 130,
editable: true,
editorOptions: statusOptions,
// In text mode the list name (To do) is shown instead of the value (todo).
...(look === 'text'
? {
formatValue: (value) => statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge',
cellRendererParams: {
map: {
todo: { label: 'To do', tone: 'neutral' },
doing: { label: 'In progress', tone: 'info' },
review: { label: 'Review', tone: 'warning' },
done: { label: 'Done', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: 'Priority',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: 'Done',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit (default true): one click opens the list on a select cell, and one click toggles a checkbox cell right away.
// With false, editing starts with a double-click or a key (F2, Enter, Space) like other cells. Text and number cells use a double-click regardless of this option.
singleClickEdit: true,
};
export function setup(api, log) {
const nameOf = (id, value) => id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log('Click a "Status" or "Priority" cell once to open the list; a "Done" cell toggles with one click. Change "Single click" and compare.');
return api.on('editCommitted', (e) => log(`Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`));
}
export const actions = {
// Can be changed at runtime with setOptions.
click: (api, value) => api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api, value) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Pick from a list, toggle with a checkbox</title>
</head>
<body>
<div class="toolbar">
<select aria-label="Look" id="look">
<option value="badge" selected>Badge</option>
<option value="text">Text</option>
</select>
<select aria-label="Single click" id="click">
<option value="single" selected>React at once (default)</option>
<option value="double">Off (double-click or keys)</option>
</select>
</div>
<div id="grid" style="height: 330px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const tasks = [
'Build login screen',
'Payment integration',
'Speed up search',
'Notification settings',
'Admin permissions',
'Deployment check',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['Low', 'Medium', 'High'];
const rows = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
let look = 'badge';
// List editing: set the column to kind: 'select' and give the values to pick in editorOptions. label is the name shown on screen.
// What you see and what you edit with are separate: cellRenderer 'badge' draws a badge, and the same list opens when editing.
const statusOptions = [
{ value: 'todo', label: 'To do' },
{ value: 'doing', label: 'In progress' },
{ value: 'review', label: 'Review' },
{ value: 'done', label: 'Done' },
];
const columns = () => [
{ id: 'task', title: 'Task', width: 190 },
{
id: 'status',
title: 'Status',
kind: 'select',
width: 130,
editable: true,
editorOptions: statusOptions,
// In text mode the list name (To do) is shown instead of the value (todo).
...(look === 'text'
? {
formatValue: (value) => statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge',
cellRendererParams: {
map: {
todo: { label: 'To do', tone: 'neutral' },
doing: { label: 'In progress', tone: 'info' },
review: { label: 'Review', tone: 'warning' },
done: { label: 'Done', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: 'Priority',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: 'Done',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
const options = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit (default true): one click opens the list on a select cell, and one click toggles a checkbox cell right away.
// With false, editing starts with a double-click or a key (F2, Enter, Space) like other cells. Text and number cells use a double-click regardless of this option.
singleClickEdit: true,
};
function setup(api, log) {
const nameOf = (id, value) => id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log('Click a "Status" or "Priority" cell once to open the list; a "Done" cell toggles with one click. Change "Single click" and compare.');
return api.on('editCommitted', (e) => log(`Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`));
}
const actions = {
// Can be changed at runtime with setOptions.
click: (api, value) => api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api, value) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};
options.ariaLabel = "Pick from a list, toggle with a checkbox";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
setup(api, (message) => {
const item = document.createElement('li');
item.textContent =
typeof message === 'string' ? message : navigator.language.startsWith('ko') ? message.ko : message.en;
document.getElementById('log').prepend(item);
});
document.getElementById('look').addEventListener('change', (event) => actions.look(api, event.target.value));
document.getElementById('click').addEventListener('change', (event) => actions.click(api, event.target.value));
</script>
</body>
</html>When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { useEffect } from 'react';
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, setup, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
useEffect(() => (api ? setup(api, console.log) : undefined), [api]);
return (
<>
<div className="toolbar">
<select
aria-label="Look"
disabled={!api}
onChange={(event) => api && actions.look(api, event.target.value)}
>
<option value="badge">Badge</option>
<option value="text">Text</option>
</select>
<select defaultValue="badge"
aria-label="Single click"
disabled={!api}
onChange={(event) => api && actions.click(api, event.target.value)}
>
<option value="single">React at once (default)</option>
<option value="double">Off (double-click or keys)</option>
</select>
</div>
<Grid style={{ height: 330 }} ref={gridRef} options={options} />
</>
);
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/react';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'Build login screen',
'Payment integration',
'Speed up search',
'Notification settings',
'Admin permissions',
'Deployment check',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['Low', 'Medium', 'High'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// List editing: set the column to kind: 'select' and give the values to pick in editorOptions. label is the name shown on screen.
// What you see and what you edit with are separate: cellRenderer 'badge' draws a badge, and the same list opens when editing.
const statusOptions = [
{ value: 'todo', label: 'To do' },
{ value: 'doing', label: 'In progress' },
{ value: 'review', label: 'Review' },
{ value: 'done', label: 'Done' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: 'Task', width: 190 },
{
id: 'status',
title: 'Status',
kind: 'select',
width: 130,
editable: true,
editorOptions: statusOptions,
// In text mode the list name (To do) is shown instead of the value (todo).
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: 'To do', tone: 'neutral' },
doing: { label: 'In progress', tone: 'info' },
review: { label: 'Review', tone: 'warning' },
done: { label: 'Done', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: 'Priority',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: 'Done',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit (default true): one click opens the list on a select cell, and one click toggles a checkbox cell right away.
// With false, editing starts with a double-click or a key (F2, Enter, Space) like other cells. Text and number cells use a double-click regardless of this option.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log(
'Click a "Status" or "Priority" cell once to open the list; a "Done" cell toggles with one click. Change "Single click" and compare.',
);
return api.on('editCommitted', (e) =>
log(
`Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
),
);
}
export const actions = {
// Can be changed at runtime with setOptions.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<script setup lang="ts">
import { onBeforeUnmount, shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, setup, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
let stop: (() => void) | undefined;
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
stop = setup(event.api, console.log);
}
onBeforeUnmount(() => stop?.());
</script>
<template>
<div class="toolbar">
<select
aria-label="Look"
:disabled="!api"
@change="api && actions.look(api, ($event.target as HTMLSelectElement).value)"
>
<option value="badge" selected>Badge</option>
<option value="text">Text</option>
</select>
<select
aria-label="Single click"
:disabled="!api"
@change="api && actions.click(api, ($event.target as HTMLSelectElement).value)"
>
<option value="single" selected>React at once (default)</option>
<option value="double">Off (double-click or keys)</option>
</select>
</div>
<Grid style="height: 330px" :options="options" @ready="onReady" />
</template>import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/vue';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'Build login screen',
'Payment integration',
'Speed up search',
'Notification settings',
'Admin permissions',
'Deployment check',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['Low', 'Medium', 'High'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// List editing: set the column to kind: 'select' and give the values to pick in editorOptions. label is the name shown on screen.
// What you see and what you edit with are separate: cellRenderer 'badge' draws a badge, and the same list opens when editing.
const statusOptions = [
{ value: 'todo', label: 'To do' },
{ value: 'doing', label: 'In progress' },
{ value: 'review', label: 'Review' },
{ value: 'done', label: 'Done' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: 'Task', width: 190 },
{
id: 'status',
title: 'Status',
kind: 'select',
width: 130,
editable: true,
editorOptions: statusOptions,
// In text mode the list name (To do) is shown instead of the value (todo).
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: 'To do', tone: 'neutral' },
doing: { label: 'In progress', tone: 'info' },
review: { label: 'Review', tone: 'warning' },
done: { label: 'Done', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: 'Priority',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: 'Done',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit (default true): one click opens the list on a select cell, and one click toggles a checkbox cell right away.
// With false, editing starts with a double-click or a key (F2, Enter, Space) like other cells. Text and number cells use a double-click regardless of this option.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log(
'Click a "Status" or "Priority" cell once to open the list; a "Done" cell toggles with one click. Change "Single click" and compare.',
);
return api.on('editCommitted', (e) =>
log(
`Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
),
);
}
export const actions = {
// Can be changed at runtime with setOptions.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Component, OnDestroy } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, setup, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="Look"
[disabled]="!api"
(change)="api && actions.look(api, $any($event.target).value)"
>
<option value="badge" selected>Badge</option>
<option value="text">Text</option>
</select>
<select
aria-label="Single click"
[disabled]="!api"
(change)="api && actions.click(api, $any($event.target).value)"
>
<option value="single" selected>React at once (default)</option>
<option value="double">Off (double-click or keys)</option>
</select>
</div>
<mx-grid style="height: 330px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent implements OnDestroy {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
private stop: (() => void) | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
this.stop = setup(this.api, console.log);
}
}
ngOnDestroy(): void {
this.stop?.();
}
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/angular';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
task: string;
status: string;
priority: string;
done: boolean;
}
const tasks = [
'Build login screen',
'Payment integration',
'Speed up search',
'Notification settings',
'Admin permissions',
'Deployment check',
];
const statuses = ['todo', 'doing', 'review', 'done'];
const priorities = ['Low', 'Medium', 'High'];
const rows: Row[] = tasks.map((task, i) => ({
id: i + 1,
task,
status: statuses[i % statuses.length],
priority: priorities[(i * 2) % priorities.length],
done: i % 4 === 3,
}));
type Look = 'badge' | 'text';
let look: Look = 'badge';
// List editing: set the column to kind: 'select' and give the values to pick in editorOptions. label is the name shown on screen.
// What you see and what you edit with are separate: cellRenderer 'badge' draws a badge, and the same list opens when editing.
const statusOptions = [
{ value: 'todo', label: 'To do' },
{ value: 'doing', label: 'In progress' },
{ value: 'review', label: 'Review' },
{ value: 'done', label: 'Done' },
];
const columns = (): ColumnDef<Row>[] => [
{ id: 'task', title: 'Task', width: 190 },
{
id: 'status',
title: 'Status',
kind: 'select',
width: 130,
editable: true,
editorOptions: statusOptions,
// In text mode the list name (To do) is shown instead of the value (todo).
...(look === 'text'
? {
formatValue: (value: unknown) =>
statusOptions.find((o) => o.value === value)?.label ?? String(value),
}
: {}),
...(look === 'badge'
? {
cellRenderer: 'badge' as const,
cellRendererParams: {
map: {
todo: { label: 'To do', tone: 'neutral' },
doing: { label: 'In progress', tone: 'info' },
review: { label: 'Review', tone: 'warning' },
done: { label: 'Done', tone: 'success' },
},
},
}
: {}),
},
{
id: 'priority',
title: 'Priority',
kind: 'select',
width: 110,
editable: true,
editorOptions: priorities.map((value) => ({ value })),
},
{
id: 'done',
title: 'Done',
kind: 'boolean',
width: 80,
align: 'center',
editable: true,
cellRenderer: 'checkbox',
},
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
// singleClickEdit (default true): one click opens the list on a select cell, and one click toggles a checkbox cell right away.
// With false, editing starts with a double-click or a key (F2, Enter, Space) like other cells. Text and number cells use a double-click regardless of this option.
singleClickEdit: true,
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
const nameOf = (id: string, value: unknown) =>
id === 'status'
? (statusOptions.find((o) => o.value === value)?.label ?? String(value))
: String(value);
const title = (id: string) => api.getColumns().find((c) => c.id === id)?.title ?? id;
log(
'Click a "Status" or "Priority" cell once to open the list; a "Done" cell toggles with one click. Change "Single click" and compare.',
);
return api.on('editCommitted', (e) =>
log(
`Row ${e.rowKey} ${title(e.columnId)}: ${nameOf(e.columnId, e.oldValue)} → ${nameOf(e.columnId, e.newValue)}`,
),
);
}
export const actions = {
// Can be changed at runtime with setOptions.
click: (api: GridApi<Row>, value?: string) =>
api.setOptions({ singleClickEdit: value !== 'double' }),
look: (api: GridApi<Row>, value?: string) => {
look = value === 'text' ? 'text' : 'badge';
api.setColumns(columns());
},
};