刷新单元格后Ag-grid React Slider列丢失mousedown事件

时间:2019-04-19 07:42:19

标签: slider refresh ag-grid

我使用的是ag-grid,它在我的react应用程序中具有滑块列。

滑块值来自行数据

mydata =  [{
    id = "1"
    name="John",
    sliderValue = 100},
   {
     id = "2"
    name="John",
    sliderValue = 50
}]

这是渲染器代码

cellRendererFramework : (params) {
    return <div>
       <Slider
           max = {100}
           min= {0}
           value = { Number(params.data.sliderValue  }
           onValueChange = { (value) => this.changeSliderValue(params.data.id, value) }}

           />
       </div>
}

这是sliderValueChanger

changeSliderValue(id, value) {

      var data = this.state.mydata
      var index = data.findIndex(myData => myData.id == id);
      data[index].sliderValue = value;

      this.setState(mydata : data)

     // i waiting for refresh slider at this point, But doesn't. 
     //  And i added below line

      this.gridApi.refreshCells({force:false})


      // and slider refreshed good, 
      // but changing 1 step on every refresh and losing mousedown event,
      // because refreshCells causing  losing mouse down event from slider, 
      // and slider stoping change itself 
      // I must press mouse button again and again for the slide left or right



}

没有这个

      this.gridApi.refreshCells({force:false})

数组值变化良好,但不会刷新滑块

与此

      this.gridApi.refreshCells({force:false})

数组值正在更改良好的刷新滑块,但是每按一下鼠标并移动一个步骤,

在不丢失mousedown事件的情况下如何正确更改滑块值

0 个答案:

没有答案