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

제목 줄 없이 목록만 보여 주기Show a list without a header row

알림이나 로그처럼 컬럼 제목이 필요 없는 목록은 헤더 줄을 감추면 더 깔끔해요. 필요하면 언제든 다시 보이게 할 수 있어요.For notices or logs that need no column titles, hiding the header row looks cleaner. Bring it back any time.

입문Beginner
직접 써 보기Live preview제목 줄 없이 목록만 보여 주기Show a list without a header row

코드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 class="toolbar">
    <select aria-label="헤더" id="header">
      <option value="hide" selected>감추기</option>
      <option value="show">보이기</option>
    </select>
  </div>
  <div id="grid" style="height: 298px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('header').addEventListener('change', (event) => actions.header(api, event.target.value));
example.js
const places = ['1호기', '2호기', '냉각 설비', '포장 라인', '출하장'];
const messages = ['정상 가동', '온도 점검 필요', '정기 점검 완료', '재고 보충 요청', '출고 대기'];
// 제목 줄이 없어도 뜻이 통하는 표(알림 목록, 로그 등)에는 showHeader: false를 써요.
export const options = {
  columns: [
    { id: 'time', title: '시각', width: 90 },
    { id: 'place', title: '장소', width: 120 },
    { id: 'message', title: '내용', width: 220 },
  ],
  rows: Array.from({ length: 8 }, (_, i) => ({
    id: i + 1,
    time: `09:${String(5 + i * 7).padStart(2, '0')}`,
    place: places[i % 5],
    message: messages[(i * 2) % 5],
  })),
  rowKey: 'id',
  showHeader: false,
};
export const actions = {
  header: (api, value) => {
    const show = value === 'show';
    // 헤더가 없으면 정렬 상태를 눈으로 확인할 수도, 바꿀 수도 없어요. 숨길 때 정렬을 함께 풀어요.
    if (!show)
      api.setSortModel([]);
    api.setOptions({ showHeader: show });
  },
};

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 class="toolbar">
    <select aria-label="Header" id="header">
      <option value="hide" selected>Hidden</option>
      <option value="show">Show header</option>
    </select>
  </div>
  <div id="grid" style="height: 298px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('header').addEventListener('change', (event) => actions.header(api, event.target.value));
example.js
const places = ['Unit 1', 'Unit 2', 'Cooling plant', 'Packing line', 'Shipping dock'];
const messages = [
  'Running normally',
  'Temperature check needed',
  'Routine check done',
  'Restock requested',
  'Awaiting shipment',
];
// Use showHeader: false for tables that make sense without a title row (notification lists, logs and so on).
export const options = {
  columns: [
    { id: 'time', title: 'Time', width: 90 },
    { id: 'place', title: 'Place', width: 130 },
    { id: 'message', title: 'Message', width: 220 },
  ],
  rows: Array.from({ length: 8 }, (_, i) => ({
    id: i + 1,
    time: `09:${String(5 + i * 7).padStart(2, '0')}`,
    place: places[i % 5],
    message: messages[(i * 2) % 5],
  })),
  rowKey: 'id',
  showHeader: false,
};
export const actions = {
  header: (api, value) => {
    const show = value === 'show';
    // Without a header you can neither see nor change the sort state, so the sort is cleared when hiding.
    if (!show)
      api.setSortModel([]);
    api.setOptions({ showHeader: show });
  },
};