Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Antd表-条件可拖动行呈现_Reactjs_Antd_React Dnd - Fatal编程技术网

Reactjs Antd表-条件可拖动行呈现

Reactjs Antd表-条件可拖动行呈现,reactjs,antd,react-dnd,Reactjs,Antd,React Dnd,我在Ant.design网站上找到了dnd的示例,但我如何才能使某些行可以拖动 更新:我有树结构(带子数据源)。我的目标是在父级中dnd第一级子级(0级数据) 更新2:我通过更改以下内容来实现: moveRow = (dragIndex, hoverIndex) => { const { data } = this.state; const dragRow = data[0].children[dragIndex]; this.setState( update(this.sta

我在Ant.design网站上找到了dnd的示例,但我如何才能使某些行可以拖动

更新:我有树结构(带子数据源)。我的目标是在父级中dnd第一级子级(0级数据)

更新2:我通过更改以下内容来实现:

  moveRow = (dragIndex, hoverIndex) => {
const { data } = this.state;
const dragRow = data[0].children[dragIndex];

this.setState(
  update(this.state, {
    data: {0: {
      children: {
      $splice: [[dragIndex, 1], [hoverIndex, 0, dragRow]],
    },}}

  }),
)

})

您可以在
rowSource
常量中编辑
beginDrag
。范例

const行源={
beginDrag(道具、监视器、组件){
dragingIndex=道具指数;
返回{
索引:props.index,
};
},
烛台(道具){
返回props.children[0]。props.record.age==32
}
};

谢谢您的帮助。我的问题更复杂,因为我有可扩展的树数据,我想在父级中dnd第一级子级。可能我得从头开始建表。。。