Skip to content
This repository was archived by the owner on Jan 15, 2022. It is now read-only.
This repository was archived by the owner on Jan 15, 2022. It is now read-only.

Rows not displayed when using .setState() #59

Open
@cryptix

Description

@cryptix

Hi,

I must admit that I'm fairly new to react but after following the introductory comment tutorial I tried to wrap my knowledge around reactable and fill it with data by calling this.setState() but it only updates the column names and now rows show up.

Here is my code so far:

/** @jsx React.DOM */
var Table = Reactable.Table;

var TableController = React.createClass({
  render: function() {
    return (
      <div className="tblControlls">
        <h3>I am a table controller! <small>source selection/limiter/deletedfilter</small></h3>
      </div>
    );
  }
});


var TableBox = React.createClass({
  getInitialState: function() {
    return {data:[]};
  },
  componentDidMount: function() {
    $.ajax({
      url: this.props.url,
      dataType: 'json',
      success:function(data) {
        console.log("Setting data - "+data.length + " items")
        this.setState({data: data});
      }.bind(this),
      error: function(xhr, status, err) {
        console.error(this.props.url, status, err.toString());
      }.bind(this)
    });
  },
  render: function() {
    return (
      <div className="tableBox">
        <TableController />
        <Table className="table table-striped" data={this.state.data}/>
      </div>
    );
  }
});



React.renderComponent(
    <TableBox url="TableData"/>
    ,document.getElementById('myTable')
);

I just installed the react dev tools, with it I can see the Tr's but they are somehow not displayed on the page.. Is this a bug or am I missing something?

reactablenorows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions