본문으로 건너뛰기Skip to content
예제 첫화면Examples home

달력·시계 단추로 날짜·시간 필터 고르기Pick a date or time filter with the picker

날짜+시간·시간 컬럼의 필터 행에 달력·시계 단추가 붙어요. 글자로 적어도 되고 선택기로 골라도 같은 필터가 걸려요.Datetime and time columns get a calendar or clock button in the filter row. Type a value or pick one; the same filter is applied.

활용Intermediate
직접 써 보기Live preview달력·시계 단추로 날짜·시간 필터 고르기Pick a date or time filter with the picker

코드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)

빌드 도구(Vite 등)를 쓰는 프로젝트용 모듈 파일이에요. 설치 없이 바로 돌려 보려면 HTML 탭이나 직접 해보기를 쓰세요.

버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.

index.html
<div id="app">
  <div id="grid" style="height: 420px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);
example.js
// 예제 틀이 알려 주는 페이지 언어(ko/en)를 그리드 locale로 써요. 샘플 데이터는 한국어 그대로예요.
const pageLang = () => (document.documentElement.dataset.lang === 'en' ? 'en' : 'ko');
// 페이지 언어가 바뀌면 그리드 locale도 따라 바꿔요. 해제 함수를 돌려줘요.
function followPageLanguage(api) {
  const watcher = new MutationObserver(() => api.setOptions({ locale: pageLang() }));
  watcher.observe(document.documentElement, { attributes: true, attributeFilter: ['data-lang'] });
  return () => watcher.disconnect();
}
// 값은 시간대 없는 'YYYY-MM-DD HH:mm'(날짜+시간)와 'HH:mm'(시간) 문자열이에요.
export const options = {
  columns: [
    { id: 'event', title: '일정', width: 140 },
    { id: 'at', title: '일시', kind: 'datetime', width: 190 },
    { id: 'start', title: '시작 시각', kind: 'time', width: 130 },
  ],
  rows: [
    { id: 1, event: '주간 회의', at: '2026-11-10 10:00', start: '10:00' },
    { id: 2, event: '고객 미팅', at: '2026-11-10 14:30', start: '14:30' },
    { id: 3, event: '코드 리뷰', at: '2026-11-11 16:05', start: '16:05' },
    { id: 4, event: '배포', at: '2026-11-12 09:00', start: '09:00' },
    { id: 5, event: '회고', at: '2026-11-13 11:15', start: '11:15' },
  ],
  rowKey: 'id',
  filterRow: true,
  filterMenu: true,
  locale: pageLang(),
};
export function setup(api, log) {
  const off = api.on('filterChanged', ({ filterModel }) => log(filterModel === null
    ? { ko: '필터 없음', en: 'No filter' }
    : {
      ko: `필터: ${filterModel.items.map((i) => `${i.columnId} ${i.operator} ${JSON.stringify(i.value ?? '')}`).join(' · ')} → ${api.getVisibleRowCount()}줄`,
      en: `Filter: ${filterModel.items.map((i) => `${i.columnId} ${i.operator} ${JSON.stringify(i.value ?? '')}`).join(' · ')} → ${api.getVisibleRowCount()} rows`,
    }));
  const stop = followPageLanguage(api);
  return () => {
    off();
    stop();
  };
}

Module files for a project with a bundler such as Vite. To run it with no setup, use the HTML tab or Try it.

When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.

index.html
<div id="app">
  <div id="grid" style="height: 420px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);
example.js
// Values are zone-less 'YYYY-MM-DD HH:mm' (date + time) and 'HH:mm' (time) strings.
export const options = {
  columns: [
    { id: 'event', title: 'Event', width: 140 },
    { id: 'at', title: 'At', kind: 'datetime', width: 190 },
    { id: 'start', title: 'Start', kind: 'time', width: 130 },
  ],
  rows: [
    { id: 1, event: 'Weekly sync', at: '2026-11-10 10:00', start: '10:00' },
    { id: 2, event: 'Client meeting', at: '2026-11-10 14:30', start: '14:30' },
    { id: 3, event: 'Code review', at: '2026-11-11 16:05', start: '16:05' },
    { id: 4, event: 'Release', at: '2026-11-12 09:00', start: '09:00' },
    { id: 5, event: 'Retrospective', at: '2026-11-13 11:15', start: '11:15' },
  ],
  rowKey: 'id',
  filterRow: true,
  filterMenu: true,
  locale: 'en',
};
export function setup(api, log) {
  const off = api.on('filterChanged', ({ filterModel }) => log(filterModel === null
    ? 'No filter'
    : `Filter: ${filterModel.items.map((i) => `${i.columnId} ${i.operator} ${JSON.stringify(i.value ?? '')}`).join(' · ')} → ${api.getVisibleRowCount()} rows`));
  return () => off();
}