mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fix Rating cells not saving to db & add warning in comments
This commit is contained in:
@@ -67,12 +67,12 @@ export interface IRenderedTableCellProps<TValue = any>
|
||||
*
|
||||
* - `EditorCell` should use the `value` and `onChange` props for the
|
||||
* rendered inputs. Avoid creating another local state here.
|
||||
* - `onSubmit` is available if `saveOnUnmount` does not work or if you want
|
||||
* to submit to the db before unmount.
|
||||
* - ✨ You can reuse your `SideDrawerField` as they take the same props. It
|
||||
* should probably be displayed in a popover.
|
||||
* - You can pass `null` to `withRenderTableCell()` to always display the
|
||||
* `DisplayCell`.
|
||||
* - ⚠️ If it’s displayed inline, you must call `onSubmit` to save the value
|
||||
* to the database, because it never unmounts.
|
||||
* - ✨ You can reuse your `SideDrawerField` as they take the same props. It
|
||||
* should probably be displayed in a popover.
|
||||
* - ⚠️ Make sure to use the `tabIndex` prop for buttons, text fields, and
|
||||
* other interactive elements.
|
||||
* - {@link IEditorCellProps}
|
||||
|
||||
@@ -4,6 +4,7 @@ import DisplayCell from "./DisplayCell";
|
||||
|
||||
export default function Rating({
|
||||
onChange,
|
||||
onSubmit,
|
||||
tabIndex,
|
||||
...props
|
||||
}: IEditorCellProps) {
|
||||
@@ -20,7 +21,10 @@ export default function Rating({
|
||||
<DisplayCell
|
||||
{...props}
|
||||
tabIndex={tabIndex}
|
||||
onChange={(_, newValue) => onChange(newValue)}
|
||||
onChange={(_, newValue) => {
|
||||
onChange(newValue);
|
||||
onSubmit();
|
||||
}}
|
||||
ref={ref}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FieldType } from "@src/constants/fields";
|
||||
import type { IRenderedTableCellProps } from "@src/components/Table/TableCell/withRenderTableCell";
|
||||
import { IRenderedTableCellProps } from "@src/components/Table/TableCell/withRenderTableCell";
|
||||
import type { PopoverProps } from "@mui/material";
|
||||
import type {
|
||||
ColumnConfig,
|
||||
|
||||
Reference in New Issue
Block a user