mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fix: saving options when creating select column
This commit is contained in:
@@ -126,8 +126,13 @@ const ColumnEditor = (props: any) => {
|
||||
};
|
||||
|
||||
const createNewColumn = () => {
|
||||
const { name, type } = values;
|
||||
actions.add(name, type);
|
||||
const { name, type, options } = values;
|
||||
if (type === FieldType.multiSelect || type === FieldType.singleSelect) {
|
||||
actions.add(name, type, { options: values.options });
|
||||
} else {
|
||||
actions.add(name, type);
|
||||
}
|
||||
|
||||
handleClose();
|
||||
clearValues();
|
||||
};
|
||||
@@ -136,6 +141,7 @@ const ColumnEditor = (props: any) => {
|
||||
handleClose();
|
||||
clearValues();
|
||||
};
|
||||
|
||||
const updateColumn = () => {
|
||||
let updatables: { field: string; value: any }[] = [
|
||||
{ field: "name", value: values.name },
|
||||
@@ -201,7 +207,6 @@ const ColumnEditor = (props: any) => {
|
||||
label="Column name"
|
||||
name="name"
|
||||
defaultValue={values.name}
|
||||
// onChange={handleChange}
|
||||
onChange={e => {
|
||||
setValue("name", e.target.value);
|
||||
}}
|
||||
|
||||
@@ -17,13 +17,13 @@ const useTableConfig = (tablePath: string) => {
|
||||
const setTable = (table: string) => {
|
||||
documentDispatch({ path: `${table}/_FIRETABLE_`, columns: [], doc: null });
|
||||
};
|
||||
const add = (name: string, type: FieldType) => {
|
||||
const add = (name: string, type: FieldType, data?: any) => {
|
||||
//TODO: validation
|
||||
const { columns } = tableConfigState;
|
||||
const key = _camelCase(name);
|
||||
documentDispatch({
|
||||
action: DocActions.update,
|
||||
data: { columns: [...columns, { name, key, type }] },
|
||||
data: { columns: [...columns, { name, key, type, ...data }] },
|
||||
});
|
||||
};
|
||||
const resize = (index: number, width: number) => {
|
||||
|
||||
Reference in New Issue
Block a user