{"action":"created","issue":{"url":"https://api.github.com/repos/museui/muse-ui/issues/145","repository_url":"https://api.github.com/repos/museui/muse-ui","labels_url":"https://api.github.com/repos/museui/muse-ui/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/museui/muse-ui/issues/145/comments","events_url":"https://api.github.com/repos/museui/muse-ui/issues/145/events","html_url":"https://github.com/museui/muse-ui/issues/145","id":194530491,"number":145,"title":"Get the multi-selected item in table component?","user":{"login":"chenyiqiao","id":11814589,"avatar_url":"https://avatars.githubusercontent.com/u/11814589?v=3","gravatar_id":"","url":"https://api.github.com/users/chenyiqiao","html_url":"https://github.com/chenyiqiao","followers_url":"https://api.github.com/users/chenyiqiao/followers","following_url":"https://api.github.com/users/chenyiqiao/following{/other_user}","gists_url":"https://api.github.com/users/chenyiqiao/gists{/gist_id}","starred_url":"https://api.github.com/users/chenyiqiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenyiqiao/subscriptions","organizations_url":"https://api.github.com/users/chenyiqiao/orgs","repos_url":"https://api.github.com/users/chenyiqiao/repos","events_url":"https://api.github.com/users/chenyiqiao/events{/privacy}","received_events_url":"https://api.github.com/users/chenyiqiao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-09T07:25:35Z","updated_at":"2016-12-09T11:57:44Z","closed_at":"2016-12-09T08:55:46Z","body":"When switch the `multiSelectable` prop in table component to true, I can multi-select items,which is pretty nice.But the items selected saved in the `tbody` components's data field `selectedRows` can be really confusing.\r\n\r\n In `tr` component:\r\n\r\n```js\r\nlet uuid = 1;\r\n\r\nexport default {\r\n  // ...\r\n  data () {\r\n    return {\r\n      hover: false,\r\n      rowId: 'tr-' + uuid++\r\n    }\r\n  }\r\n}\r\n\r\n```\r\n\r\nWhat's the point of `uuid`? In my opinion, It's straightforward if i can transfer a variable as `tr`'s prop, the variable here can be a index of the selected rows of data, or id that specify this row of data. Whatever it is, it   should serve as the rowId, siginifies the items that i've chosen.\r\n\r\n\r\nFor exmaple, say i can write a template like this:\r\n\r\n```html\r\n<mu-thead>\r\n  <mu-tr>\r\n    <mu-th>name</mu-th>\r\n  </mu-tr>\r\n</mu-thead>\r\n<mu-tbody>\r\n  <mu-tr v-for=\"(role, idx) in roles\" :rowId=\"role.id\">\r\n    <mu-td>{{role.name}}</mu-td>\r\n  </mu-tr>\r\n</mu-tbody>\r\n```\r\n\r\nand my list of data : \r\n\r\n```js\r\nvar data = [\r\n  {\r\n     id: 'a',name:'Arnold'\r\n  },\r\n  {\r\n    id: 'b', name: 'Bernard'\r\n  },\r\n  {\r\n    id: 'd', name: 'Dolores'\r\n  }\r\n]\r\n```\r\n\r\nWhen i choose the first two of them,i want the `selectedRows` to be :\r\n\r\n```\r\n['a', 'b']\r\n```\r\n\r\nrather than \r\n\r\n```\r\n['tr-213', 'tr-214']\r\n```\r\n\r\nIn this case, I can get `['a', 'b']` in `tbody` as `selectedRows`,which i can pickup and use right away.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/museui/muse-ui/issues/comments/265997709","html_url":"https://github.com/museui/muse-ui/issues/145#issuecomment-265997709","issue_url":"https://api.github.com/repos/museui/muse-ui/issues/145","id":265997709,"user":{"login":"chenyiqiao","id":11814589,"avatar_url":"https://avatars.githubusercontent.com/u/11814589?v=3","gravatar_id":"","url":"https://api.github.com/users/chenyiqiao","html_url":"https://github.com/chenyiqiao","followers_url":"https://api.github.com/users/chenyiqiao/followers","following_url":"https://api.github.com/users/chenyiqiao/following{/other_user}","gists_url":"https://api.github.com/users/chenyiqiao/gists{/gist_id}","starred_url":"https://api.github.com/users/chenyiqiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenyiqiao/subscriptions","organizations_url":"https://api.github.com/users/chenyiqiao/orgs","repos_url":"https://api.github.com/users/chenyiqiao/repos","events_url":"https://api.github.com/users/chenyiqiao/events{/privacy}","received_events_url":"https://api.github.com/users/chenyiqiao/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T11:57:44Z","updated_at":"2016-12-09T11:57:44Z","body":"firstly, the tr in thead also has a rowId so that the first tr in tbody has a rowId of `tr-2`, which is wrong. \r\n\r\nSecondly, say i have a lot of tables in it my SPA, when i navigate from page to page,as several tables appears, the rowId just add up as if a table has a lot a lot of rows,unless i refresh the page. Maybe all of the `tr`s share the uuid and that's incorrect. As for this,you can check [Table](https://museui.github.io/#/table), when you select rows in the second table, the `rowId` actually starts from `tr-7`."}}
{"actor":{"display_login":"chenyiqiao"}}