Use bind to take variable value rather than reference: make room directory able to join rooms

pull/1/head
David Baker 2015-07-21 08:05:58 -07:00
parent 4679e005bf
commit 71f5d1f6cb
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ module.exports = React.createClass({
if (rooms[i].aliases[0]) name += " (" + rooms[i].aliases[0] + ")"; if (rooms[i].aliases[0]) name += " (" + rooms[i].aliases[0] + ")";
} }
rows.unshift( rows.unshift(
<tr key={ rooms[i].room_id } onClick={ function() { self.joinRoom(rooms[i].room_id); } }> <tr key={ rooms[i].room_id } onClick={self.joinRoom.bind(null, rooms[i].room_id)}>
<td><img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/> { name }</td> <td><img src={ MatrixClientPeg.get().getAvatarUrlForRoom(rooms[i].room_id, 40, 40, "crop") } width="40" height="40" alt=""/> { name }</td>
<td>{ rooms[i].topic }</td> <td>{ rooms[i].topic }</td>
<td style={ {'text-align' : 'center'} }>{ rooms[i].num_joined_members }</td> <td style={ {'text-align' : 'center'} }>{ rooms[i].num_joined_members }</td>