Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom table row component #134

Merged
merged 3 commits into from
Apr 27, 2015
Merged

Add custom table row component #134

merged 3 commits into from
Apr 27, 2015

Conversation

ryanlanciaux
Copy link
Member

This allows custom table rows to be created. Documentation still needs to be updated and it would likely be good to state that the names on the custom components will likely change before ver 1 is out (aka customRow and customTableRow components are kind of confusing names).

A rough example of a customTableRowComponent is as follows:

   var CustomRow = React.createClass({
      getInitialState: function() {
        return { editToggled: false };
      },
      handleClick: function(e){
        this.setState({editToggled: !this.state.editToggled });
      },
      render: function(){
        if(this.state.editToggled){
          var cols = _.map(_.pairs(this.props.data), function(col, index){
            return <td><input type="text" defaultValue={col[1]} style={{width: "100%", height: "100%", color: "#CCC"}} />{index === _.pairs(this.props.data).length -1 ? 
              <button onClick={this.handleClick} style={{position: "absolute", right: 0}}>Done</button> : null}</td>
          }, this);
        }
        return this.state.editToggled ?
          <tr>{cols}</tr> :
          <Griddle.GridRow {...this.props} onRowClick={this.handleClick} />;
      }
    });

@6ewis
Copy link

6ewis commented Sep 1, 2015

What's the status?

@etodanik
Copy link

etodanik commented Jan 4, 2016

@ryanlanciaux Is it just me or does this merge use either lodash or underscore without actually require-ing it?

@FirstWhack
Copy link

FirstWhack commented Sep 2, 2016

This was never documented in any way.

@emorling
Copy link

emorling commented Jan 6, 2017

Does this allow easy editing of the underlying data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants