Used data to trigger table re-render
This commit is contained in:
parent
a4b0a915f6
commit
e9fc02f700
3 changed files with 9 additions and 10 deletions
|
|
@ -4,7 +4,6 @@ import TableAutoCellRender from "../../../components/tableComponent/components/t
|
||||||
import TableNodeCellRender from "../../../components/tableComponent/components/tableNodeCellRender";
|
import TableNodeCellRender from "../../../components/tableComponent/components/tableNodeCellRender";
|
||||||
import TableToggleCellRender from "../../../components/tableComponent/components/tableToggleCellRender";
|
import TableToggleCellRender from "../../../components/tableComponent/components/tableToggleCellRender";
|
||||||
import TableTooltipRender from "../../../components/tableComponent/components/tableTooltipRender";
|
import TableTooltipRender from "../../../components/tableComponent/components/tableTooltipRender";
|
||||||
import TableMultilineCellRender from "../../../components/tableComponent/components/tableMultilineCellRender";
|
|
||||||
|
|
||||||
const useColumnDefs = (
|
const useColumnDefs = (
|
||||||
myData: any,
|
myData: any,
|
||||||
|
|
@ -51,10 +50,10 @@ const useColumnDefs = (
|
||||||
valueGetter: (params: ValueGetterParams) => {
|
valueGetter: (params: ValueGetterParams) => {
|
||||||
return {
|
return {
|
||||||
value: params.data.value,
|
value: params.data.value,
|
||||||
nodeClass: myData.current.node,
|
nodeClass: myData.node,
|
||||||
handleOnNewValue: handleOnNewValue,
|
handleOnNewValue: handleOnNewValue,
|
||||||
handleOnChangeDb: (value, key) => {
|
handleOnChangeDb: (value, key) => {
|
||||||
myData.current.node!.template[key].load_from_db = value;
|
myData.node!.template[key].load_from_db = value;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -83,7 +82,7 @@ const useColumnDefs = (
|
||||||
cellClass: "no-border",
|
cellClass: "no-border",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[open],
|
[open, myData],
|
||||||
);
|
);
|
||||||
|
|
||||||
return columnDefs;
|
return columnDefs;
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import { TemplateVariableType } from "../../../types/api";
|
||||||
|
|
||||||
const useRowData = (myData, open) => {
|
const useRowData = (myData, open) => {
|
||||||
const rowData = useMemo(() => {
|
const rowData = useMemo(() => {
|
||||||
return Object.keys(myData.current.node!.template)
|
return Object.keys(myData.node!.template)
|
||||||
.filter((key: string) => {
|
.filter((key: string) => {
|
||||||
const templateParam = myData.current.node!.template[
|
const templateParam = myData.node!.template[
|
||||||
key
|
key
|
||||||
] as TemplateVariableType;
|
] as TemplateVariableType;
|
||||||
return (
|
return (
|
||||||
|
|
@ -20,7 +20,7 @@ const useRowData = (myData, open) => {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.map((key: string) => {
|
.map((key: string) => {
|
||||||
const templateParam = myData.current.node!.template[
|
const templateParam = myData.node!.template[
|
||||||
key
|
key
|
||||||
] as TemplateVariableType;
|
] as TemplateVariableType;
|
||||||
return {
|
return {
|
||||||
|
|
@ -29,7 +29,7 @@ const useRowData = (myData, open) => {
|
||||||
id: key,
|
id: key,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}, [open]);
|
}, [open, myData]);
|
||||||
|
|
||||||
return rowData;
|
return rowData;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ const EditNodeModal = forwardRef(
|
||||||
myData.current.node!.template[name].value = newValue;
|
myData.current.node!.template[name].value = newValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowData = useRowData(myData, open);
|
const rowData = useRowData(data, open);
|
||||||
|
|
||||||
const columnDefs: ColDef[] = useColumnDefs(
|
const columnDefs: ColDef[] = useColumnDefs(
|
||||||
myData,
|
data,
|
||||||
handleOnNewValue,
|
handleOnNewValue,
|
||||||
changeAdvanced,
|
changeAdvanced,
|
||||||
open,
|
open,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue