| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,3 +58,30 @@ export function onScroll(args: EventData) { | |||
| 58 | 58 | } | |
| 59 | 59 | scrollToBottom = !scrollToBottom; | |
| 60 | 60 | } | |
| 61 | + | ||
| 62 | + export function onScrollToIndex(args: EventData) { | ||
| 63 | + let page = (<View>args.object).page; | ||
| 64 | + let gridLayout = page.getViewById<GridLayout>("grid-layout"); | ||
| 65 | + for (let i = 0, length = gridLayout.getChildrenCount(); i < length; i++) { | ||
| 66 | + let listView = <ListView>gridLayout.getChildAt(i); | ||
| 67 | + listView.scrollToIndex(50); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + export function onScrollToIndexAnimated(args: EventData) { | ||
| 72 | + let page = (<View>args.object).page; | ||
| 73 | + let gridLayout = page.getViewById<GridLayout>("grid-layout"); | ||
| 74 | + for (let i = 0, length = gridLayout.getChildrenCount(); i < length; i++) { | ||
| 75 | + let listView = <ListView>gridLayout.getChildAt(i); | ||
| 76 | + listView.scrollToIndexAnimated(50); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + export function onScrollReset(args: EventData) { | ||
| 81 | + let page = (<View>args.object).page; | ||
| 82 | + let gridLayout = page.getViewById<GridLayout>("grid-layout"); | ||
| 83 | + for (let i = 0, length = gridLayout.getChildrenCount(); i < length; i++) { | ||
| 84 | + let listView = <ListView>gridLayout.getChildAt(i); | ||
| 85 | + listView.scrollToIndex(0); | ||
| 86 | + } | ||
| 87 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,11 @@ | |||
| 1 | 1 | <Page loaded="pageLoaded"> | |
| 2 | 2 | <StackLayout> | |
| 3 | - <Button text="SCROLL" tap="onScroll" height="30"/> | ||
| 3 | + <StackLayout> | ||
| 4 | + <Button text="RESET" tap="onScrollReset" height="30"/> | ||
| 5 | + <Button text="SCROLL" tap="onScroll" height="30"/> | ||
| 6 | + <Button text="SCROLL TO INDEX 50" tap="onScrollToIndex" height="30"/> | ||
| 7 | + <Button text="SCROLL TO INDEX 50 ANIMATED" tap="onScrollToIndexAnimated" height="30"/> | ||
| 8 | + </StackLayout> | ||
| 4 | 9 | <GridLayout id="grid-layout" columns="*,*" rows="*,*"> | |
| 5 | 10 | <ListView id="lv1" col="0" row="0" items="{{ items }}" itemTemplateSelector="selectItemTemplate"> | |
| 6 | 11 | <ListView.itemTemplates> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments