{"action":"created","issue":{"url":"https://api.github.com/repos/ThorQin/tui/issues/3","labels_url":"https://api.github.com/repos/ThorQin/tui/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/ThorQin/tui/issues/3/comments","events_url":"https://api.github.com/repos/ThorQin/tui/issues/3/events","html_url":"https://github.com/ThorQin/tui/issues/3","id":113999765,"number":3,"title":"两个Grid中的scrollbar联动问题","user":{"login":"xhy008","id":716954,"avatar_url":"https://avatars.githubusercontent.com/u/716954?v=3","gravatar_id":"","url":"https://api.github.com/users/xhy008","html_url":"https://github.com/xhy008","followers_url":"https://api.github.com/users/xhy008/followers","following_url":"https://api.github.com/users/xhy008/following{/other_user}","gists_url":"https://api.github.com/users/xhy008/gists{/gist_id}","starred_url":"https://api.github.com/users/xhy008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xhy008/subscriptions","organizations_url":"https://api.github.com/users/xhy008/orgs","repos_url":"https://api.github.com/users/xhy008/repos","events_url":"https://api.github.com/users/xhy008/events{/privacy}","received_events_url":"https://api.github.com/users/xhy008/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-29T08:11:00Z","updated_at":"2015-10-31T05:53:38Z","closed_at":"2015-10-31T05:53:38Z","body":"目前我有两个grid，想通过scrollbar实现两个grid联动（上下排列，共用同一个header），所以使用动了scrollbar.scroll事件，一个scrollbar变更了，则设置另一个scrollbar.value。但由于value方法中没有fire scroll事件，所以另一个grid并没有一同移动。\r\n\r\n我目前的变通方法是在value方法中fire scroll事件。请帮忙看看是不是有问题，或者提供下其它实现方式，谢谢。\r\n\r\n\r\ntui.ctrl.scrollbar.ts 现有代码：\r\n\r\n    value(val?: number): any {\r\n    \tif (typeof val === \"number\") {\r\n    \t\tval = Math.round(val);\r\n    \t\tif (val < 0)\r\n    \t\t\tval = 0;\r\n    \t\tif (val > this.total())\r\n    \t\t\tval = this.total();\r\n    \t\tthis.attr(\"data-value\", val);\r\n    \t\tthis.refresh();\r\n    \t\treturn this;\r\n    \t} else {\r\n    \t\tvar val = parseInt(this.attr(\"data-value\"), 10);\r\n    \t\tif (val === null || isNaN(val))\r\n    \t\t\treturn 0;\r\n    \t\telse\r\n    \t\t\treturn val;\r\n    \t}\r\n    }\r\n\r\n修改后的代码：\r\n\r\n    value(val?: number): any {\r\n    \tif (typeof val === \"number\") {\r\n    \t\tval = Math.round(val);\r\n    \t\tif (val < 0)\r\n    \t\t\tval = 0;\r\n    \t\tif (val > this.total())\r\n    \t\t\tval = this.total();\r\n\r\n            var needFireScroll = false;\r\n            if (val != this.attr(\"data-value\")) {\r\n                needFireScroll = true;\r\n            }\r\n            this.attr(\"data-value\", val);\r\n            this.refresh();\r\n            if (needFireScroll) {\r\n                this.fire(\"scroll\", { value: val, type: \"valueChange\" });\r\n            }\r\n            return this;\r\n    \t} else {\r\n    \t\tvar val = parseInt(this.attr(\"data-value\"), 10);\r\n    \t\tif (val === null || isNaN(val))\r\n    \t\t\treturn 0;\r\n    \t\telse\r\n    \t\t\treturn val;\r\n    \t}\r\n    }\r\n \r\n\r\n两个Grid联动的代码：\r\n\r\n        var scrollbar1 = tui.ctrl.scrollbar($(\"#grid1 .tui-scrollbar[data-direction='horizontal']\")[0]);\r\n        var scrollbar2 = tui.ctrl.scrollbar($(\"#grid2 .tui-scrollbar[data-direction='horizontal']\")[0]);\r\n        scrollbar1.on(\"scroll\", function(args) {\r\n            scrollbar2.value(args.value);\r\n        });\r\n        scrollbar2.on(\"scroll\", function(args) {\r\n            scrollbar1.value(args.value);\r\n        });\r\n   "},"comment":{"url":"https://api.github.com/repos/ThorQin/tui/issues/comments/152697818","html_url":"https://github.com/ThorQin/tui/issues/3#issuecomment-152697818","issue_url":"https://api.github.com/repos/ThorQin/tui/issues/3","id":152697818,"user":{"login":"xhy008","id":716954,"avatar_url":"https://avatars.githubusercontent.com/u/716954?v=3","gravatar_id":"","url":"https://api.github.com/users/xhy008","html_url":"https://github.com/xhy008","followers_url":"https://api.github.com/users/xhy008/followers","following_url":"https://api.github.com/users/xhy008/following{/other_user}","gists_url":"https://api.github.com/users/xhy008/gists{/gist_id}","starred_url":"https://api.github.com/users/xhy008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xhy008/subscriptions","organizations_url":"https://api.github.com/users/xhy008/orgs","repos_url":"https://api.github.com/users/xhy008/repos","events_url":"https://api.github.com/users/xhy008/events{/privacy}","received_events_url":"https://api.github.com/users/xhy008/received_events","type":"User","site_admin":false},"created_at":"2015-10-31T05:53:38Z","updated_at":"2015-10-31T05:53:38Z","body":"十分感谢你提供的解决方案。\r\n：）"}}