import React from "react";
import { DataEditorAll as DataEditor } from "../../data-editor-all.js";
import {
BeautifulWrapper,
Description,
PropName,
useMockDataGenerator,
defaultProps,
} from "../../data-editor/stories/utils.js";
import { SimpleThemeWrapper } from "../../stories/story-utils.js";
export default {
title: "Glide-Data-Grid/DataEditor Demos",
decorators: [
(Story: React.ComponentType) => (
A DOM element may be added as a trailer to the grid by using the{" "}
rightElement prop.
}>
),
],
};
export const RightElement: React.VFC = () => {
const { cols, getCellContent, setCellValue } = useMockDataGenerator(8, false);
const columns = React.useMemo(() => cols.map(c => ({ ...c, grow: 1 })), [cols]);
const [numRows, setNumRows] = React.useState(300);
const onRowAppended = React.useCallback(() => {
const newRow = numRows;
setNumRows(cv => cv + 1);
for (let c = 0; c < 6; c++) {
setCellValue([c, newRow], {
displayData: "",
data: "",
} as any);
}
}, [numRows, setCellValue]);
return (
This is a real DOM element. You can put whatever you want here. You can also size it as big as you
want. {"\n\n"}It also does not have to be sticky.
}
/>
);
};