2016-07-24 47 views
0

在我的AgGrid我標記爲dirty如果我有一個修改它。如果它是dirty===true那麼我想彈出一個對話框,如果有人試圖對列進行排序,詢問是否真正對列進行排序。所以我需要一個方法如何壓制排序如何防止動態排序

我想我可以使用事件beforeSortChanged,但它不提供任何參數。我還沒有發現任何處理程序來抑制排序/過濾。有沒有辦法做到這一點?

回答

0

我使用ag-grid-react所以我不得不做兩件事情:

<AgGridReact 
    ... 
    enableSorting="true" // REMOVE THIS LINE 
/> 

this.gridOptions = { 

    onCellValueChanged(){ 
     this.isDirty = true; 
    } 
} 

componentWillReceiveProps(nextProps){ 
    this.isDirty = nextProps.isDirty; 
    this.gridOptions.enableServerSideSorting = !this.isDirty; 
}