Hi Jonathan,
Greetings from Syncfusion support.
We have checked your requirement with DashboardLayout component.
Query 1- I want to be able to dynamically remove and restore this panel. Remove is no problem, but when I want to restore the panel, how can I execute the react component class correctly?
Based on your shared details, we found out the you are using inline-rendering for render the DashboardLayout component. You can restore the panel using serialize method of DashboardLayout component.
Refer the below code snippet.
|
save() {
this.restoreModel = this.dashboardObj.serialize();
}
restore(){
this.dashboardObj.panels = this.restoreModel;
} |
Refer the sample link. In this sample, save the panel settings and remove the panel and then click the restore button.
Query 2- How do I create a panel dynamically.
We have add the panel dynamically through addPanel method of DashboardLayout component. In our sample browser site, we have add the panel using AddPanel method. Refer the below link.
Refer the below code snippet.
|
btnClick() {
let proxy = this;
let panel = [{
'id': this.count.toString() + '_layout', 'sizeX': 1, 'sizeY': 1, 'row': 0, 'col': 0,
content: this.lineTemplate
}];
proxy.dashboardObj.addPanel(panel[0]);
this.count = this.count + 1;
} |
However, we have facing some issue when restore the newly added panel in DashboardLayout component. Could you please confirm whether the following is your reported problem occurring case?.
Are you want to dynamically add the panel and then restore the panel position after deleting it?
Based on your update, we will further validate with this case to find the cause of your reported problem in Dashboard Layout and to provide you the prompt solution.
Refer the below link to know more about the DashboardLayout component.
Please let us know, if you need any further assistance.
Regards,
Sowmiya.P