テスト用のDataProvider

未分類
import { Grid, GridDataProviderCallback, GridDataProviderParams } from "@vaadin/react-components/Grid";

const dataProvider = async (
  params: GridDataProviderParams<{id: string; name: string;}>,
  callback: GridDataProviderCallback<{id: string; name: string;}>
) => {
  const start = params.page * params.pageSize;
  const end = start + params.pageSize;
  const content = [];
  for (let i = start; i < end; i += 1) {
    content.push({ id: `${i}`, name: `項目${i}` });
  }
  callback(content, 10000);
};

コメント

タイトルとURLをコピーしました