raychenfj / ion-multi-picker

Multi Item Picker - An Ionic Custom Multi Picker Component
https://raychenfj.github.io/ion-multi-picker/
Other
236 stars 103 forks source link

Get the data from the network #29

Closed jun1362008 closed 7 years ago

jun1362008 commented 7 years ago

Thank you so much for this demo. Now I hope to get the data from the network and then update the columns, what should I do?

raychenfj commented 7 years ago

Hi @jun1362008 I suppose when you say 'network', you mean from a backend server right ?

So you know, ionic2 is build upon angular2. Getting remote data is nothing special. Basically, in the ngOnInit of your page or component, you need to send http request to your backend server, then in the callback, update your columns based on the response data.

Here is angular2 http client

jun1362008 commented 7 years ago

Thank you for your answer. But I want to update the columns with different async data. Such as the province, city, district, I want to get the async data when I change the columns.

raychenfj commented 7 years ago

@jun1362008 Unfortunately, there is no way to get async data while you are interacting with the picker. You have to initialize the columns at the very beginning then bind it to the picker.

However, I guess you can try the parentVal attribute, it can establish relation between each columns. When the parent column is changed, the child column will be changed as well.