sccoreui 5.9.91 → 5.9.92
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,35 @@ 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
|
-
const updatedColumnDefs = existingColumns.map((colDef) => {
|
|
259
|
-
columnFromProps.find((col) => {
|
|
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).map((newCol) => {
|
|
256
|
+
const existingCol = prevGridData.columnData.find((col) => col.field === newCol.field);
|
|
257
|
+
if (existingCol) {
|
|
258
|
+
return Object.assign(Object.assign({}, existingCol), newCol);
|
|
263
259
|
}
|
|
260
|
+
return newCol;
|
|
264
261
|
});
|
|
265
|
-
return
|
|
262
|
+
return Object.assign(Object.assign({}, prevGridData), { columnData: updatedColumns });
|
|
266
263
|
});
|
|
267
|
-
const reOrderedColumns = updatedColumnDefs.sort((a, b) => a.seq - b.seq);
|
|
268
|
-
gridRef.current.api.setGridOption("columnDefs", reOrderedColumns);
|
|
269
264
|
}, [props === null || props === void 0 ? void 0 : props.columnData]);
|
|
265
|
+
// useEffect(()=>{
|
|
266
|
+
// const existingColumns:any = gridRef?.current!.api?.getColumnDefs();
|
|
267
|
+
// if(!props?.columnData || !existingColumns) return
|
|
268
|
+
// const columnFromProps:ColumnDef[] = sortColumns(props?.columnData)
|
|
269
|
+
// const updatedColumnDefs = existingColumns.map((colDef) => {
|
|
270
|
+
// columnFromProps.find((col: ColumnDef) => {
|
|
271
|
+
// if (col.id === colDef.id) {
|
|
272
|
+
// colDef.hide = col.hide;
|
|
273
|
+
// colDef.seq = col?.seq
|
|
274
|
+
// }
|
|
275
|
+
// });
|
|
276
|
+
// return colDef;
|
|
277
|
+
// });
|
|
278
|
+
// const reOrderedColumns = updatedColumnDefs.sort((a,b)=>a.seq-b.seq)
|
|
279
|
+
// gridRef.current!.api.setGridOption("columnDefs",reOrderedColumns);
|
|
280
|
+
// },[props?.columnData])
|
|
270
281
|
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
282
|
featureDetails,
|
|
272
283
|
setFeatureDetails,
|