Expanding one row updating the value of all the expanded rows with the latest value
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- bootstrap, javascript, react, redux
- 领域
- frontend
调研方向
从 issue 中显示的 expandRow renderer 和 NewRecordContent/JobRequestedDate component 开始,然后追踪 getJobRequestedDate 和 Redux state props。展开两行来复现问题,并验证每一行都保留自己的 API 值;当后续展开不再替换之前已展开行的数据时,issue 即得到解决。
由索引模型根据 Issue 内容生成。
描述
I have a requirement to call the API to retrieve the value and show value when the expand row is selected. Each row is having a different value which is received by using an API. For example:
There are ten rows displayed on the dashboard with expanding row indicator (individual as well as expand all). If row one is expanded then there will be an API call to retrieve the data and show it under the expanded row. If the second row expanded then there will be another API call to retrieve the data that belongs to the second row and show the same without impacting the first-row data.
I am facing an issue where all the expanded rows are updated with the latest expanded row data which is received from the latest row API call. As part of the issue investigation, I observed that render is called for all the expanded rows instead of the current expanded row.
Note: I am using sagas for API calls. And used the component to retrieve the data from API and store it in the props, show the data in the expanded row.
Can you please help me with how to fix the issue?
Here is the code snippet:
<BootstrapTable
{...props.baseProps}
bootstrap4
pagination={ paginationFactory() }
defaultSorted={ defaultSorted }
filter={ filterFactory() }
loading={ props.loading }
expandRow={ expandRow }
headerClasses="header-class"
noDataIndication="There are currently no active or historic requests."
striped
hover
condensed
/>
const expandRow = {
className: 'expanding-row',
parentClassName: 'expanding-parent-row',
onlyOneExpanding: false,
showExpandColumn: true,
expandByColumnOnly: true,
renderer: row => (
<-Container>
<-Row>
<-Col>
<-NewRecordContent Id={row.Id}/>
<-/Col>
<-/Row>
<-/Container>
)
};
--> NewRecordContent component:
import React from 'react';
import moment from 'moment'
import {getJobRequestedDate} from "../actions/jobRequestedDatetActions";
import { connect } from "react-redux";
type Props = any;
class JobRequestedDate extends React.Component {
constructor(props) { super(props); }
componentDidMount() { this.props.getJobRequestedDate(this.props.Id) }
componentWillUnmount() {
this.setState(
{
requestedDate: []
},
() => {}
);
}
render() {
let jobRequestedAt = this.props.job.report.lastJobRequestAt
return (
<>
<p>Job Requested at: <b><strong>{jobRequestedAt !== undefined ? moment(jobRequestedAt).format("Do MMM YYYY, HH:mm") : ""} </strong></b></p>
</>
)
}
}
const mapStateToProps = state => ({
job: state.report
});
const mapDispatchToProps = dispatch => {
return {
getLocationReport: (Id) => dispatch(getJobReport(Id)),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(JobRequestedDate);
- 主要语言
- JavaScript
- 星标
- 2.2k
- 派生
- 758
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AllenFang/react-bootstrap-table 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
AllenFang/react-bootstrap-table#2053 ·
-
难度 3/5 1-2 天 新手友好度 20/100
AllenFang/react-bootstrap-table#2144 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
AllenFang/react-bootstrap-table#2143 ·
-
难度 4/5 3-5 天 新手友好度 25/100
AllenFang/react-bootstrap-table#2142 ·
-
难度 3/5 1-2 天 新手友好度 25/100
AllenFang/react-bootstrap-table#2141 ·
查看 AllenFang/react-bootstrap-table 的全部 Issue
相似的 Issue
-
release-followup
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
area: right sidebar
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
cleanup
难度 2/5 1-3 小时 新手友好度 65/100
uclaacm/membership-portal-ui#409 ·
维护者通常 1 天内回复