달력 글자 바꾸기Change the calendar text
dateTime.labels로 달력의 월 이름, 요일 머리글, 달 제목, 연도 제목을 원하는 글자로 바꿔요. 읽어 주는 전체 날짜는 그대로예요.dateTime.labels replaces the month names, weekday heads, month title and year title of the calendar. The spoken full date stays the same.
코드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">
<button type="button" id="edit">첫 줄 편집</button>
<select aria-label="글자" id="labels">
<option value="default">기본</option>
<option value="short" selected>짧은 한글</option>
<option value="english">영어 약어</option>
</select>
</div>
<div id="grid" style="height: 340px"></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('edit').addEventListener('click', () => actions.edit(api));
document.getElementById('labels').addEventListener('change', (event) => actions.labels(api, event.target.value));const pageLang = () => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) => `${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which) => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current, log) {
const off = current.on('editCommitted', ({ rowKey, newValue }) => log(`row ${rowKey} = ${String(newValue)}`));
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current) => current.startEdit(1, 'day'),
labels: (current, value) => current.setColumns(columns(value ?? 'short')),
};<!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">
<button type="button" id="edit">첫 줄 편집</button>
<select aria-label="글자" id="labels">
<option value="default">기본</option>
<option value="short" selected>짧은 한글</option>
<option value="english">영어 약어</option>
</select>
</div>
<div id="grid" style="height: 340px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const pageLang = () => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) => `${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which) => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
const options = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
function setup(current, log) {
const off = current.on('editCommitted', ({ rowKey, newValue }) => log(`row ${rowKey} = ${String(newValue)}`));
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
const actions = {
edit: (current) => current.startEdit(1, 'day'),
labels: (current, value) => current.setColumns(columns(value ?? 'short')),
};
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('edit').addEventListener('click', () => actions.edit(api));
document.getElementById('labels').addEventListener('change', (event) => actions.labels(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">
<button
type="button"
disabled={!api}
onClick={() => api && actions.edit(api)}
>첫 줄 편집</button>
<select
aria-label="글자"
disabled={!api}
onChange={(event) => api && actions.labels(api, event.target.value)}
>
<option value="default">기본</option>
<option value="short">짧은 한글</option>
<option value="english">영어 약어</option>
</select>
</div>
<Grid style={{ height: 340 }} ref={gridRef} options={options} />
</>
);
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};버튼을 누르면 이 예제의 코드가 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">
<button type="button" :disabled="!api" @click="api && actions.edit(api)">첫 줄 편집</button>
<select
aria-label="글자"
:disabled="!api"
@change="api && actions.labels(api, ($event.target as HTMLSelectElement).value)"
>
<option value="default">기본</option>
<option value="short" selected>짧은 한글</option>
<option value="english">영어 약어</option>
</select>
</div>
<Grid style="height: 340px" :options="options" @ready="onReady" />
</template>import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};버튼을 누르면 이 예제의 코드가 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">
<button
type="button"
[disabled]="!api"
(click)="api && actions.edit(api)"
>첫 줄 편집</button>
<select
aria-label="글자"
[disabled]="!api"
(change)="api && actions.labels(api, $any($event.target).value)"
>
<option value="default">기본</option>
<option value="short" selected>짧은 한글</option>
<option value="english">영어 약어</option>
</select>
</div>
<mx-grid style="height: 340px" [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 interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<div id="app">
<div class="toolbar">
<button type="button" id="edit">Edit first row</button>
<select aria-label="Text" id="labels">
<option value="default">Default</option>
<option value="short" selected>Short Korean</option>
<option value="english">English short</option>
</select>
</div>
<div id="grid" style="height: 340px"></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('edit').addEventListener('click', () => actions.edit(api));
document.getElementById('labels').addEventListener('change', (event) => actions.labels(api, event.target.value));const pageLang = () => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) => `${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which) => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current, log) {
const off = current.on('editCommitted', ({ rowKey, newValue }) => log(`row ${rowKey} = ${String(newValue)}`));
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current) => current.startEdit(1, 'day'),
labels: (current, value) => current.setColumns(columns(value ?? 'short')),
};<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Change the calendar text</title>
</head>
<body>
<div class="toolbar">
<button type="button" id="edit">Edit first row</button>
<select aria-label="Text" id="labels">
<option value="default">Default</option>
<option value="short" selected>Short Korean</option>
<option value="english">English short</option>
</select>
</div>
<div id="grid" style="height: 340px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const pageLang = () => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) => `${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which) => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
const options = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
function setup(current, log) {
const off = current.on('editCommitted', ({ rowKey, newValue }) => log(`row ${rowKey} = ${String(newValue)}`));
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
const actions = {
edit: (current) => current.startEdit(1, 'day'),
labels: (current, value) => current.setColumns(columns(value ?? 'short')),
};
options.ariaLabel = "Change the calendar text";
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('edit').addEventListener('click', () => actions.edit(api));
document.getElementById('labels').addEventListener('change', (event) => actions.labels(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">
<button
type="button"
disabled={!api}
onClick={() => api && actions.edit(api)}
>Edit first row</button>
<select
aria-label="Text"
disabled={!api}
onChange={(event) => api && actions.labels(api, event.target.value)}
>
<option value="default">Default</option>
<option value="short">Short Korean</option>
<option value="english">English short</option>
</select>
</div>
<Grid style={{ height: 340 }} ref={gridRef} options={options} />
</>
);
}import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};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">
<button type="button" :disabled="!api" @click="api && actions.edit(api)">Edit first row</button>
<select
aria-label="Text"
:disabled="!api"
@change="api && actions.labels(api, ($event.target as HTMLSelectElement).value)"
>
<option value="default">Default</option>
<option value="short" selected>Short Korean</option>
<option value="english">English short</option>
</select>
</div>
<Grid style="height: 340px" :options="options" @ready="onReady" />
</template>import type { ColumnDef, GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};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">
<button
type="button"
[disabled]="!api"
(click)="api && actions.edit(api)"
>Edit first row</button>
<select
aria-label="Text"
[disabled]="!api"
(change)="api && actions.labels(api, $any($event.target).value)"
>
<option value="default">Default</option>
<option value="short" selected>Short Korean</option>
<option value="english">English short</option>
</select>
</div>
<mx-grid style="height: 340px" [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 interface Row {
id: number;
name: string;
day: string;
}
const pageLang = (): 'ko' | 'en' => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// labels: months(12개)·weekdays(7개, 일요일부터)·monthTitle·yearTitle로 달력 글자를 바꿔요(읽어 주는 이름은 그대로).
const LABELS: Record<string, NonNullable<ColumnDef<Row>['dateTime']>['labels']> = {
default: undefined,
short: {
months: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
weekdays: ['일', '월', '화', '수', '목', '금', '토'],
monthTitle: (year, month) => `${year}년 ${month}월`,
yearTitle: (year) => `${year}년`,
},
english: {
months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
monthTitle: (year, month) =>
`${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month - 1]} ${year}`,
yearTitle: (year) => `Year ${year}`,
},
};
const columns = (which: string): ColumnDef<Row>[] => {
const labels = LABELS[which];
return [
{ id: 'name', title: '행사', width: 150 },
{
id: 'day',
title: '날짜',
kind: 'date',
width: 160,
editable: true,
dateTime: labels === undefined ? {} : { labels },
},
];
};
export const options: GridOptions<Row> = {
columns: columns('short'),
rows: [
{ id: 1, name: '워크숍', day: '2026-03-05' },
{ id: 2, name: '발표', day: '2026-04-20' },
],
rowKey: 'id',
locale: pageLang(),
};
export function setup(current: GridApi<Row>, log: (message: string) => void) {
const off = current.on('editCommitted', ({ rowKey, newValue }) =>
log(`row ${rowKey} = ${String(newValue)}`),
);
const watcher = new MutationObserver(() => current.setOptions({ locale: pageLang() }));
watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
return () => {
off();
watcher.disconnect();
};
}
export const actions = {
edit: (current: GridApi<Row>) => current.startEdit(1, 'day'),
labels: (current: GridApi<Row>, value?: string) => current.setColumns(columns(value ?? 'short')),
};