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

This commit is contained in:
David Baker 2015-07-21 08:05:58 -07:00
parent 4679e005bf
commit 71f5d1f6cb

View File

@ -91,7 +91,7 @@ module.exports = React.createClass({
if (rooms[i].aliases[0]) name += " (" + rooms[i].aliases[0] + ")";
}
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>{ rooms[i].topic }</td>
<td style={ {'text-align' : 'center'} }>{ rooms[i].num_joined_members }</td>