You have to use if-else condition on button click. Also, you have initialize one more global variable which will keep the track of total number of values you have got. As mentioned by @dora_paz, you can check out these guides:
Just replace On Vertical Scroll Reached Bottom event with On Button Click event and you are good to go.