如何在没有window.reload()的情况下重新渲染?

时间:2017-09-26 06:51:03

标签: javascript reactjs highcharts rendering

我在应用过滤器时应用模型中的过滤器图表不会在window.reload()上重新呈现,只有过滤器被应用。但是当我们正在制作window.reload()时,应用的过滤器将被删除。我需要在重新加载后应用过滤器,应该不应删除应用的过滤器。直到用户删除

_handleFilterClick(chartId){
      let filterdefinitions = {
        dataSourceId: this.state.dataSourceId,
        filterDefinitions: this.state.filterData,
      }

      let data = {
        filterDefinitions: [filterdefinitions],
      };


      DashboardAction._ApplicableFilterToDashboard(data, this.props.params.dashboardId);
      DashboardAction._ApplicableFilterToChart(data, this.props.params.dashboardId, chartId);
      DashboardAction._saveFilterToDashboard(data, this.props.params.dashboardId);


}


export function _saveFilterToDashboard(data, dashboardId){
dispatcher.dispatch({
    type:'Loader',
    showLoader: true 

})
data = JSON.stringify(data);
let url = "/dashboardServices/saveFiltersToDashboard?userName=bigDataViz&dashboardId=" + dashboardId 
Api._callAPI( url, 'POST', data, (type,dt) => {
    if(type == 'success'){      

        if(dt.responseCode == 1){
            dispatcher.dispatch({
                type:'SnackBar',
                string: "Filter not updated successfully"
            })
            return;
        }
        if(dt.responseCode == 0){
            dispatcher.dispatch({
                type:'SnackBar',
                string: "Dashboard filter updated succesfully."
            })
            window.location.reload();
        } 
    }

});}

0 个答案:

没有答案
相关问题