주요 콘텐츠로 건너뛰기

move-field

설명

필드 순서를 변경할 때 발생합니다

사용법

"move-field": ({
area: string,
id: string | number,
before?: string,
after?: string
}) => void | boolean;

매개변수

action의 callback은 다음 매개변수를 포함하는 객체를 받습니다:

  • area - (필수) 순서 변경이 이루어지는 영역의 이름으로, "rows", "columns" 또는 "values" 영역이 될 수 있습니다
  • id - (필수) 이동되는 필드의 id
  • before - (선택) 이동된 필드가 앞에 배치될 필드의 id
  • after - (선택) 이동된 필드가 뒤에 배치될 필드의 id
정보

내부 이벤트를 처리하려면 Event Bus 메서드를 사용할 수 있습니다

예제

const table = new pivot.Pivot("#root", {
fields,
data: dataset,
config: {
rows: ["studio", "genre"],
columns: [],
values: [
{
field: "title",
method: "count"
},
{
field: "score",
method: "max"
}
]
}
});

//순서가 변경된 필드의 id를 콘솔에 출력합니다
table.api.on("move-field", (ev) => {
console.log("The id of the reordered field:", ev.id);
});

관련 문서: api.on()