Commit 60f86e50 by Ooh-Ao

datagrid

parent f3665be7
...@@ -116,7 +116,7 @@ export class DashboardViewerComponent implements OnInit { ...@@ -116,7 +116,7 @@ export class DashboardViewerComponent implements OnInit {
if (dashboard) { if (dashboard) {
if (dashboard.widgets) { if (dashboard.widgets) {
dashboard.widgets.forEach(widget => { dashboard.widgets.forEach(widget => {
const keysToProcess: Array<keyof WidgetModel> = ['config', 'perspective', 'data']; const keysToProcess: Array<keyof WidgetModel> = ['config', 'data'];
keysToProcess.forEach(key => { keysToProcess.forEach(key => {
if ((widget as any)[key] && typeof (widget as any)[key] === 'string') { if ((widget as any)[key] && typeof (widget as any)[key] === 'string') {
try { try {
...@@ -153,7 +153,7 @@ export class DashboardViewerComponent implements OnInit { ...@@ -153,7 +153,7 @@ export class DashboardViewerComponent implements OnInit {
row: widget.y, row: widget.y,
col: widget.x, col: widget.x,
componentType: this.widgetComponentMap[widget.component], componentType: this.widgetComponentMap[widget.component],
componentInputs: { config: widget.config || {} }, componentInputs: { config: widget.config || {}, perspective: widget.perspective },
}; };
}); });
} }
......
...@@ -184,7 +184,9 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple ...@@ -184,7 +184,9 @@ export class SyncfusionDatagridWidgetComponent extends BaseWidgetComponent imple
onDataBound(args: any): void { onDataBound(args: any): void {
// Apply perspective after data is loaded and rendered, but only once. // Apply perspective after data is loaded and rendered, but only once.
if (this.perspective && !this.isPerspectiveApplied) { if (this.perspective && !this.isPerspectiveApplied) {
this.setWidgetState(this.perspective as string); setTimeout(() => {
this.setWidgetState(this.perspective as string);
}, 50); // Small delay to ensure rendering is complete
} }
} }
......
...@@ -93,6 +93,7 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen ...@@ -93,6 +93,7 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen
columns: report.columns?.map(c => ({ name: c.name })) || [], columns: report.columns?.map(c => ({ name: c.name })) || [],
values: report.values?.map(v => ({ name: v.name, type: v.type })) || [], values: report.values?.map(v => ({ name: v.name, type: v.type })) || [],
filters: report.filters?.map(f => ({ name: f.name })) || [], filters: report.filters?.map(f => ({ name: f.name })) || [],
chartSettings: { chartSeries: { type: (this.pivotview.chartSettings?.chartSeries as any)?.type || (this.chartSettings?.chartSeries as any)?.type } },
}; };
return JSON.stringify(perspective); return JSON.stringify(perspective);
} }
...@@ -110,6 +111,10 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen ...@@ -110,6 +111,10 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen
values: perspective.values || [], values: perspective.values || [],
filters: perspective.filters || [], filters: perspective.filters || [],
}; };
if (perspective.chartSettings) {
this.chartSettings = perspective.chartSettings;
this.dataSourceSettings.chartSettings = perspective.chartSettings;
}
if (this.pivotview) { if (this.pivotview) {
this.pivotview.dataSourceSettings = this.dataSourceSettings; this.pivotview.dataSourceSettings = this.dataSourceSettings;
} }
...@@ -134,7 +139,9 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen ...@@ -134,7 +139,9 @@ export class SyncfusionPivotWidgetComponent extends BaseWidgetComponent implemen
onDataBound(args: any): void { onDataBound(args: any): void {
// Apply perspective after data is loaded and rendered, but only once. // Apply perspective after data is loaded and rendered, but only once.
if (this.perspective && !this.isPerspectiveApplied) { if (this.perspective && !this.isPerspectiveApplied) {
this.setWidgetState(this.perspective as string); setTimeout(() => {
this.setWidgetState(this.perspective as string);
}, 50); // Small delay to ensure rendering is complete
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment