sccoreui 5.9.91 → 5.9.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -249,24 +249,37 @@ function ParentForGrid(props) {
|
|
|
249
249
|
callBackForCheckedRows(featureDetails);
|
|
250
250
|
}
|
|
251
251
|
}, [featureDetails]);
|
|
252
|
+
// Update gridData.columnData whenever props.columnData changes
|
|
252
253
|
(0, react_1.useEffect)(() => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (col.id === colDef.id) {
|
|
261
|
-
colDef.hide = col.hide;
|
|
262
|
-
colDef.seq = col === null || col === void 0 ? void 0 : col.seq;
|
|
254
|
+
setGridData((prevGridData) => {
|
|
255
|
+
const updatedColumns = (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData)
|
|
256
|
+
.filter(newCol => newCol.id) // Ensure only columns with an `id` are processed
|
|
257
|
+
.map((newCol) => {
|
|
258
|
+
const existingCol = prevGridData.columnData.find((col) => col.id === newCol.id);
|
|
259
|
+
if (existingCol) {
|
|
260
|
+
return Object.assign(Object.assign({}, existingCol), newCol);
|
|
263
261
|
}
|
|
262
|
+
return newCol;
|
|
264
263
|
});
|
|
265
|
-
return
|
|
264
|
+
return Object.assign(Object.assign({}, prevGridData), { columnData: updatedColumns });
|
|
266
265
|
});
|
|
267
|
-
const reOrderedColumns = updatedColumnDefs.sort((a, b) => a.seq - b.seq);
|
|
268
|
-
gridRef.current.api.setGridOption("columnDefs", reOrderedColumns);
|
|
269
266
|
}, [props === null || props === void 0 ? void 0 : props.columnData]);
|
|
267
|
+
// useEffect(()=>{
|
|
268
|
+
// const existingColumns:any = gridRef?.current!.api?.getColumnDefs();
|
|
269
|
+
// if(!props?.columnData || !existingColumns) return
|
|
270
|
+
// const columnFromProps:ColumnDef[] = sortColumns(props?.columnData)
|
|
271
|
+
// const updatedColumnDefs = existingColumns.map((colDef) => {
|
|
272
|
+
// columnFromProps.find((col: ColumnDef) => {
|
|
273
|
+
// if (col.id === colDef.id) {
|
|
274
|
+
// colDef.hide = col.hide;
|
|
275
|
+
// colDef.seq = col?.seq
|
|
276
|
+
// }
|
|
277
|
+
// });
|
|
278
|
+
// return colDef;
|
|
279
|
+
// });
|
|
280
|
+
// const reOrderedColumns = updatedColumnDefs.sort((a,b)=>a.seq-b.seq)
|
|
281
|
+
// gridRef.current!.api.setGridOption("columnDefs",reOrderedColumns);
|
|
282
|
+
// },[props?.columnData])
|
|
270
283
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { height: style.height, width: style.width }, className: "ag-grid-container border-1 border-gray-200 border-round" }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(context_provider_1.default, Object.assign({ value: {
|
|
271
284
|
featureDetails,
|
|
272
285
|
setFeatureDetails,
|