mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fixed creating the first table, indecate empty table
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
### Functionality:
|
||||
|
||||
- Sort rows
|
||||
- reorder columns
|
||||
- Locked columns
|
||||
- Table view only mode
|
||||
- SubCollection tables
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useState } from "react";
|
||||
import React, { useCallback } from "react";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import useUploader from "../../hooks/useFiretable/useUploader";
|
||||
|
||||
|
||||
@@ -132,6 +132,20 @@ function Table(props: any) {
|
||||
onColumnResize={(idx, width) =>
|
||||
tableActions.column.resize(idx, width)
|
||||
}
|
||||
emptyRowsView={() => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
textAlign: "center",
|
||||
backgroundColor: "#ddd",
|
||||
padding: "100px",
|
||||
}}
|
||||
>
|
||||
<h3>no data to show</h3>
|
||||
<Button onClick={tableActions.row.add}>Add Row</Button>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Button onClick={tableActions.row.add}>Add Row</Button>
|
||||
<ColumnEditor
|
||||
|
||||
@@ -17,10 +17,17 @@ const useSettings = () => {
|
||||
const createTable = (name: string, collection: string) => {
|
||||
const { tables } = settingsState;
|
||||
// updates the setting doc
|
||||
documentDispatch({
|
||||
action: DocActions.update,
|
||||
data: { tables: [...tables, { name, collection }] },
|
||||
});
|
||||
if (tables) {
|
||||
documentDispatch({
|
||||
action: DocActions.update,
|
||||
data: { tables: [...tables, { name, collection }] },
|
||||
});
|
||||
} else {
|
||||
db.doc("_FIRETABLE_/settings").set(
|
||||
{ tables: [{ name, collection }] },
|
||||
{ merge: true }
|
||||
);
|
||||
}
|
||||
//create the firetable collection doc with empty columns
|
||||
db.collection(collection)
|
||||
.doc("_FIRETABLE_")
|
||||
|
||||
Reference in New Issue
Block a user