Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Expanding one row updating the value of all the expanded rows with the latest value

未关闭
#2,134 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AllenFang/react-bootstrap-table 的其他 Issue

查看 AllenFang/react-bootstrap-table 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。