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

둥근 아이콘 스타일The soft icon style

iconStyle: 'soft'는 정렬 화살표, 트리 화살표, 체크, 닫기 ×, 끌기 손잡이, 별점을 둥근 끝의 선 아이콘으로 바꿔요. 기본은 'default'이고 icons 옵션으로 정한 아이콘은 늘 그대로예요.iconStyle: 'soft' swaps the sort arrows, tree arrows, check marks, close ×, drag grip and rating stars for round-ended line icons. The default is 'default', and icons you set with the icons option always stay as they are.

입문Beginner
직접 써 보기Live preview둥근 아이콘 스타일The soft icon style

코드Code

탭을 골라 코드를 복사하세요. 위 화면은 이 코드를 그대로 실행한 결과예요.Pick a tab and copy the code. The preview above runs exactly this code.

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

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

index.html
<div id="app">
  <div class="toolbar">
    <select aria-label="아이콘 스타일" id="iconStyle">
      <option value="default">기본</option>
      <option value="soft" selected>둥글게</option>
    </select>
  </div>
  <div id="grid" style="height: 230px"></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('iconStyle').addEventListener('change', (event) => actions.iconStyle(api, event.target.value));
example.js
const en = document.documentElement.dataset.lang === 'en';
const rows = [
  {
    id: 1,
    parentId: null,
    name: en ? 'Launch' : '출시',
    team: en ? 'Dev' : '개발',
    done: false,
    score: 4,
  },
  {
    id: 2,
    parentId: 1,
    name: en ? 'Design' : '디자인',
    team: en ? 'Design' : '디자인',
    done: true,
    score: 5,
  },
  {
    id: 3,
    parentId: 1,
    name: en ? 'Build' : '구현',
    team: en ? 'Dev' : '개발',
    done: false,
    score: 3,
  },
  {
    id: 4,
    parentId: null,
    name: en ? 'Support' : '지원',
    team: en ? 'Ops' : '운영',
    done: true,
    score: 2,
  },
  {
    id: 5,
    parentId: 4,
    name: en ? 'Docs' : '문서',
    team: en ? 'Ops' : '운영',
    done: true,
    score: 4,
  },
];
export const options = {
  columns: [
    { id: 'name', title: en ? 'Task' : '작업', width: 170, sortable: true },
    { id: 'team', title: en ? 'Team' : '팀', width: 110, sortable: true },
    { id: 'done', title: en ? 'Done' : '완료', width: 80, cellRenderer: 'checkbox' },
    { id: 'score', title: en ? 'Score' : '점수', width: 130, cellRenderer: 'rating' },
  ],
  rows,
  rowKey: 'id',
  tree: { parentKey: 'parentId', expandDepth: 'all' },
  // iconStyle: 'soft'면 정렬 화살표·펼침 화살표·체크·별이 모두 둥근 선 아이콘이 돼요. 기본은 'default'예요.
  iconStyle: 'soft',
};
export const actions = {
  iconStyle: (api, value) => {
    if (value === 'default' || value === 'soft')
      api.setOptions({ iconStyle: value });
  },
};

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="Icon style" id="iconStyle">
      <option value="default">Default</option>
      <option value="soft" selected>Soft</option>
    </select>
  </div>
  <div id="grid" style="height: 230px"></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('iconStyle').addEventListener('change', (event) => actions.iconStyle(api, event.target.value));
example.js
const rows = [
  { id: 1, parentId: null, name: 'Launch', team: 'Dev', done: false, score: 4 },
  { id: 2, parentId: 1, name: 'Design', team: 'Design', done: true, score: 5 },
  { id: 3, parentId: 1, name: 'Build', team: 'Dev', done: false, score: 3 },
  { id: 4, parentId: null, name: 'Support', team: 'Ops', done: true, score: 2 },
  { id: 5, parentId: 4, name: 'Docs', team: 'Ops', done: true, score: 4 },
];
export const options = {
  columns: [
    { id: 'name', title: 'Task', width: 170, sortable: true },
    { id: 'team', title: 'Team', width: 110, sortable: true },
    { id: 'done', title: 'Done', width: 80, cellRenderer: 'checkbox' },
    { id: 'score', title: 'Score', width: 130, cellRenderer: 'rating' },
  ],
  rows,
  rowKey: 'id',
  tree: { parentKey: 'parentId', expandDepth: 'all' },
  // With iconStyle: 'soft', the sort arrows, expand arrows, checks and stars all become rounded line icons. The default is 'default'.
  iconStyle: 'soft',
};
export const actions = {
  iconStyle: (api, value) => {
    if (value === 'default' || value === 'soft')
      api.setOptions({ iconStyle: value });
  },
};