React Jquery数据表表中没有可用数据

时间:2019-03-22 08:52:58

标签: jquery reactjs datatables

我是新来的反应者。出于我的目的,我在项目中使用了jquery数据表,效果很好。但是问题是它显示第一行为“表中没有可用数据”,之后仅显示我的数据。如何解决这个问题呢。如果有人可以帮助的话,将是非常可观的。

我的代码如下所示。其中的数据来自load()方法。

$.DataTable = require("datatables.net");
class Forward_To_Ho extends Component {
  constructor(props) {
    super(props);
    this.getList = this.getList.bind(this);
    this.state = {
      forwardtoholist: [],
      selected: [],
      forwardToHoError: "",
      selectedaccountid: 0
    };
    this.loadList();

    // this.loadList = this.loadList.bind(this);
  }

  componentWillMount() {
    ForwardToHoStore.on("changefho", this.getList);
  }

  //WARNING! To be deprecated in React v17. Use componentDidMount instead.
  componentDidMount() {
    $(document).ready(function() {
      $("#forwardtohotable").DataTable();
    });
  }
  componentWillUnmount() {
    // You might need to use eval(result)
    ForwardToHoStore.on("changefho", this.getList);
  }

  loadList() {
    ForwardToHoAction.getAllForwardToHo();
    //  this.setState({
    //    forwardtoholist: ForwardToHoAction.getList()
  }

在我的ID为“ forwardtohotable”的表中很傻。

0 个答案:

没有答案