react
react copied to clipboard
this.refs giving empty in while logging ```this```` refs is not empty in componentdidMount
code componentDidMount
componentDidMount : function(){
console.log(this.props.location.query.request)
this.refs[this.props.location.query.request].show()
}
render code:
getTableContent : function(){
var tableContent = [],DialogBox = []
for( var e in this.state.data){
var status ;
if (this.state.data[e].request_status == 0){
status = "open234"
}else if (this.state.data[e].request_status == 1) {
status = "closed"
}
DialogBox.push (
<Dialog ref={this.state.data[e].id}
title="Request" >
s/aldlkashl tony123345
<ViewRequest request={this.state.data[e]}/>
<p> askdjgasjk </p>
</Dialog>
)
tableContent.push(
<TableRow rowNumber={this.state.data[e].id} >
<TableRowColumn >
{this.state.data[e].request_category}
</TableRowColumn>
<TableRowColumn >
{status}
</TableRowColumn>
<TableRowColumn style= {{ display: "none"}}>
{this.state.data[e].id}
</TableRowColumn>
</TableRow>
)
}
return { "tableContent" : tableContent , "DialogBox" : DialogBox }
},
render : function(){
var content = this.getTableContent()
var page = this.getPage()
console.log(this)
console.log(this.state)
return (
<div>
<Table allRowsSelected={false} onCellClick={this.redirect}>
<TableHeader adjustForCheckbox={false}>
<TableRow onclick={this.redirect}>
<TableHeaderColumn>
Request
</TableHeaderColumn>
<TableHeaderColumn>
Status
</TableHeaderColumn>
<TableHeaderColumn style = {{ display : "none"}}>
id
</TableHeaderColumn>
</TableRow>
</TableHeader>
<TableBody displayRowCheckbox = {false }>
{content["tableContent"]}
</TableBody>
</Table>
{content["DialogBox"]}
</div>
)
}
what is the problem here ?
This is not nearly enough information for me to have a hope of helping you. If you are still having a problem, please post a simple repro case in jsbin or jsfiddle that shows the problem, including what behavior you expected and what you see instead.