PDA

View Full Version : How to load Select Field values from a JsonP store?



cstuber
18 Feb 2012, 3:42 PM
I'm building a Touch app using Designer 2 build 288.

I have created a simple Form Panel with a FieldSet. One of my input form fields is a Select Field.

At runtime I want to load the possible values for my Select Field using the result of a JsonP call.

I have a model and a JsonP Store defined. The JsonP store's model property is set to the model name. I then specified my JsonP store for the "store" property value of my Select Field.

Unfortunately, the Select Field possible values do not appear when I run the app. However, I can see in the browser that the JsonP call is being triggered and the data containing possible value is returned from the server.

I feel like I'm missing something. What steps are required to properly link a Select Field to a JsonP store in Designer 2? Are there additional steps I need to take to map my JsonP store data to the "text" and "value" properties of my Select Field?

Any help would be appreciated!

Chad

cstuber
19 Feb 2012, 8:15 AM
Hi everyone,

After sleeping on this and making a few tweaks I was able to get my Select Field values populated with values from a JsonP store.

Here are the additional steps I took:

1) Make sure your "rootProperty" Json reader property is populated if applicable. This was an oversight on my part.

2) Create your model with two fields named "value" and "text" to match the Select Field properties of the same names.

3) If your JsonP call does not return field names of "value" and "text," use the model fields' "mapping" property. Here you can specify which Json field names are used for the value and text fields in the model.

After those changes everything is working great!

Chad

aconran
20 Feb 2012, 7:31 AM
Chad, Thanks for updating the thread and letting everyone know how you solved the problem.

avrmraja
1 Mar 2013, 4:58 AM
Hi...I managed to display data using a webservice url in list with


navigation view in the designer but when it runs in browser it displays


empty then upon some reference for cross domain heard JSONP should be


used.. But not able to load data to store using jsonp.. It displays


error "unable to load data with specified configuration".. I loaded


model using rest proxy is ter any changes to be made..
Thanks in advance!!!

soportedo
18 Mar 2013, 8:39 AM
Can you post your store, and model?

I can't get Jsonp to work with stores.... =(