ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

React-grid-layout props store update with size and position


#1

I am using React-grid-layout component on drag of container I am calling API with grid parameters of width height position after dragging the paper the values are updating in the API in the response also. I need to update with those values when I come to the page again, on refresh I am getting the old values of react grid layout width and height but on drag the layout grid properties width and height are in different way. How to resolve that.

Thanks in Advanve. Immediate response will be very helpful

 onLayoutChange(layout, dashboardId) {
  let saveLayoutchart = DashboardStore._getSaveLayout() || {};
        var dashObj={};
        dashObj.dashboardId=this.props.params.dashboardId;
        var dashboardLayout={};
        var layoutChartId= saveLayoutchart.responseDto.chartIds;
        for(var i=0;i<layout.length;i++)
        {
         console.log(layout[i])
         dashboardLayout[layoutChartId[i]] =layout[i];
        }
        dashObj.dashboardLayout=dashboardLayout;
        DashboardAction._saveLayoutToDashboard(dashObj);

 }

I need to update height and width with these updated values when window.relod happens but i am able to fetch the initial rendering of height and width