{"action":"created","issue":{"url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/326","repository_url":"https://api.github.com/repos/AllenFang/react-bootstrap-table","labels_url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/326/labels{/name}","comments_url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/326/comments","events_url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/326/events","html_url":"https://github.com/AllenFang/react-bootstrap-table/issues/326","id":139732637,"number":326,"title":"how to access this.state from within onSelect","user":{"login":"mikedevita","id":2991640,"avatar_url":"https://avatars.githubusercontent.com/u/2991640?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedevita","html_url":"https://github.com/mikedevita","followers_url":"https://api.github.com/users/mikedevita/followers","following_url":"https://api.github.com/users/mikedevita/following{/other_user}","gists_url":"https://api.github.com/users/mikedevita/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedevita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedevita/subscriptions","organizations_url":"https://api.github.com/users/mikedevita/orgs","repos_url":"https://api.github.com/users/mikedevita/repos","events_url":"https://api.github.com/users/mikedevita/events{/privacy}","received_events_url":"https://api.github.com/users/mikedevita/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-09T23:26:22Z","updated_at":"2016-03-10T17:03:40Z","closed_at":"2016-03-10T01:45:25Z","body":"what is the *proper* way to handle a scenario like this?\r\n\r\nI have a table of data, and i need to be able to select one or more and all and then click a button.\r\n\r\nThat button needs to then be able to get a list of all those selected items and do other actions using those selected items data.\r\n\r\nI have a state like so\r\n```\r\nthis.state = {\r\n  selected: []\r\n}\r\n```\r\nI was trying to access `this.state` from within the `onSelect: ()` but it doesn't like that. My thought was to check if `isSelected === true` and if it does, push/concat `row` into `this.state.selected` and do a splice/slice as needed to remove that given item from the selected array.\r\n\r\nThen when the button is clicked I can just read from `this.state.selected`."},"comment":{"url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/comments/194957419","html_url":"https://github.com/AllenFang/react-bootstrap-table/issues/326#issuecomment-194957419","issue_url":"https://api.github.com/repos/AllenFang/react-bootstrap-table/issues/326","id":194957419,"user":{"login":"mikedevita","id":2991640,"avatar_url":"https://avatars.githubusercontent.com/u/2991640?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedevita","html_url":"https://github.com/mikedevita","followers_url":"https://api.github.com/users/mikedevita/followers","following_url":"https://api.github.com/users/mikedevita/following{/other_user}","gists_url":"https://api.github.com/users/mikedevita/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedevita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedevita/subscriptions","organizations_url":"https://api.github.com/users/mikedevita/orgs","repos_url":"https://api.github.com/users/mikedevita/repos","events_url":"https://api.github.com/users/mikedevita/events{/privacy}","received_events_url":"https://api.github.com/users/mikedevita/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T17:03:40Z","updated_at":"2016-03-10T17:03:40Z","body":"@AllenFang how are you `bind(this)` to `this.onRowSelect`.. when I use your example, `this.state` is undefined as onRowSelect hasn't been bound to the component's `this`\r\n\r\nadding a `console.log(this)` inside of `onRowSelect` you'll see that `this` is a reference to the row object, and not the component `this`.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/2991640/13677458/50c804ea-e6a7-11e5-8197-dac553c0f750.png)\r\n"}}